diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-06 16:56:19 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-06 16:56:19 +0000 |
commit | 7ff48ca7c36e03a70d42838b57d7576fd6866fd3 (patch) | |
tree | a4094090054ef5954b381625c6116b5cf9ad49d1 /base/task_runner_util_unittest.cc | |
parent | 3eb2899b90415acb389db29933f1bfe249f6355d (diff) | |
download | chromium_src-7ff48ca7c36e03a70d42838b57d7576fd6866fd3.zip chromium_src-7ff48ca7c36e03a70d42838b57d7576fd6866fd3.tar.gz chromium_src-7ff48ca7c36e03a70d42838b57d7576fd6866fd3.tar.bz2 |
base: Convert the remaining uses of MessageLoop::RunUntilIdle to RunLoop variant.
The former method is deprecated and actually it is just using RunLoop internally.
The later is the cannonical method and should be used instead.
BUG=131220
TEST=base_unittests
R=darin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12226007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/task_runner_util_unittest.cc')
-rw-r--r-- | base/task_runner_util_unittest.cc | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/base/task_runner_util_unittest.cc b/base/task_runner_util_unittest.cc index d4d3769..f02a388 100644 --- a/base/task_runner_util_unittest.cc +++ b/base/task_runner_util_unittest.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/message_loop.h" +#include "base/run_loop.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -65,31 +66,29 @@ void ExpectScopedFoo(scoped_ptr_malloc<Foo, FreeFooFunctor> foo) { } // namespace TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResult) { - MessageLoop message_loop; int result = 0; - PostTaskAndReplyWithResult( - message_loop.message_loop_proxy(), - FROM_HERE, - Bind(&ReturnFourtyTwo), - Bind(&StoreValue, &result)); + MessageLoop message_loop; + PostTaskAndReplyWithResult(message_loop.message_loop_proxy(), + FROM_HERE, + Bind(&ReturnFourtyTwo), + Bind(&StoreValue, &result)); - message_loop.RunUntilIdle(); + RunLoop().RunUntilIdle(); EXPECT_EQ(42, result); } TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultImplicitConvert) { - MessageLoop message_loop; double result = 0; - PostTaskAndReplyWithResult( - message_loop.message_loop_proxy(), - FROM_HERE, - Bind(&ReturnFourtyTwo), - Bind(&StoreDoubleValue, &result)); + MessageLoop message_loop; + PostTaskAndReplyWithResult(message_loop.message_loop_proxy(), + FROM_HERE, + Bind(&ReturnFourtyTwo), + Bind(&StoreDoubleValue, &result)); - message_loop.RunUntilIdle(); + RunLoop().RunUntilIdle(); EXPECT_DOUBLE_EQ(42.0, result); } @@ -99,14 +98,12 @@ TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassed) { g_foo_free_count = 0; MessageLoop message_loop; + PostTaskAndReplyWithResult(message_loop.message_loop_proxy(), + FROM_HERE, + Bind(&CreateFoo), + Bind(&ExpectFoo)); - PostTaskAndReplyWithResult( - message_loop.message_loop_proxy(), - FROM_HERE, - Bind(&CreateFoo), - Bind(&ExpectFoo)); - - message_loop.RunUntilIdle(); + RunLoop().RunUntilIdle(); EXPECT_EQ(1, g_foo_destruct_count); EXPECT_EQ(0, g_foo_free_count); @@ -117,14 +114,12 @@ TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassedFreeProc) { g_foo_free_count = 0; MessageLoop message_loop; + PostTaskAndReplyWithResult(message_loop.message_loop_proxy(), + FROM_HERE, + Bind(&CreateScopedFoo), + Bind(&ExpectScopedFoo)); - PostTaskAndReplyWithResult( - message_loop.message_loop_proxy(), - FROM_HERE, - Bind(&CreateScopedFoo), - Bind(&ExpectScopedFoo)); - - message_loop.RunUntilIdle(); + RunLoop().RunUntilIdle(); EXPECT_EQ(1, g_foo_destruct_count); EXPECT_EQ(1, g_foo_free_count); |