diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/deferred_sequenced_task_runner_unittest.cc | 2 | ||||
-rw-r--r-- | base/hi_res_timer_manager_unittest.cc | 2 | ||||
-rw-r--r-- | base/mac/libdispatch_task_runner_unittest.cc | 11 | ||||
-rw-r--r-- | base/message_loop_unittest.cc | 2 | ||||
-rw-r--r-- | base/prefs/pref_service.cc | 2 | ||||
-rw-r--r-- | base/threading/thread_unittest.cc | 8 | ||||
-rw-r--r-- | base/timer_unittest.cc | 95 |
7 files changed, 63 insertions, 59 deletions
diff --git a/base/deferred_sequenced_task_runner_unittest.cc b/base/deferred_sequenced_task_runner_unittest.cc index c033ba8..c20e174 100644 --- a/base/deferred_sequenced_task_runner_unittest.cc +++ b/base/deferred_sequenced_task_runner_unittest.cc @@ -64,7 +64,7 @@ class DeferredSequencedTaskRunnerTest : public testing::Test, new base::DeferredSequencedTaskRunner(loop_.message_loop_proxy())) { } - MessageLoop loop_; + base::MessageLoop loop_; scoped_refptr<base::DeferredSequencedTaskRunner> runner_; mutable base::Lock lock_; std::vector<int> executed_task_ids_; diff --git a/base/hi_res_timer_manager_unittest.cc b/base/hi_res_timer_manager_unittest.cc index 601586d..b523284 100644 --- a/base/hi_res_timer_manager_unittest.cc +++ b/base/hi_res_timer_manager_unittest.cc @@ -13,7 +13,7 @@ #if defined(OS_WIN) // http://crbug.com/114048 TEST(HiResTimerManagerTest, DISABLED_ToggleOnOff) { - MessageLoop loop; + base::MessageLoop loop; scoped_ptr<base::PowerMonitor> power_monitor(new base::PowerMonitor()); HighResolutionTimerManager manager; diff --git a/base/mac/libdispatch_task_runner_unittest.cc b/base/mac/libdispatch_task_runner_unittest.cc index 5ebe8d2..cf0dd0e 100644 --- a/base/mac/libdispatch_task_runner_unittest.cc +++ b/base/mac/libdispatch_task_runner_unittest.cc @@ -22,7 +22,7 @@ class LibDispatchTaskRunnerTest : public testing::Test { void DispatchLastTask() { dispatch_async(task_runner_->GetDispatchQueue(), ^{ (&message_loop_)->PostTask(FROM_HERE, - MessageLoop::QuitWhenIdleClosure()); + base::MessageLoop::QuitWhenIdleClosure()); }); message_loop_.Run(); task_runner_->Shutdown(); @@ -52,7 +52,7 @@ class LibDispatchTaskRunnerTest : public testing::Test { } // The message loop for the test main thread. - MessageLoop message_loop_; + base::MessageLoop message_loop_; // The task runner under test. scoped_refptr<base::mac::LibDispatchTaskRunner> task_runner_; @@ -117,7 +117,7 @@ TEST_F(LibDispatchTaskRunnerTest, PostTaskWithinTask) { TEST_F(LibDispatchTaskRunnerTest, NoMessageLoop) { task_runner_->PostTask(FROM_HERE, base::BindBlock(^{ TaskOrderMarker marker(this, - base::StringPrintf("MessageLoop = %p", MessageLoop::current())); + base::StringPrintf("MessageLoop = %p", base::MessageLoop::current())); })); DispatchLastTask(); @@ -158,7 +158,7 @@ TEST_F(LibDispatchTaskRunnerTest, NonNestable) { task_runner_->PostNonNestableTask(FROM_HERE, base::BindBlock(^{ TaskOrderMarker marker(this, "Second NonNestable"); (&message_loop_)->PostTask(FROM_HERE, - MessageLoop::QuitWhenIdleClosure()); + base::MessageLoop::QuitWhenIdleClosure()); })); })); message_loop_.Run(); @@ -183,7 +183,8 @@ TEST_F(LibDispatchTaskRunnerTest, PostDelayed) { task_runner_->PostDelayedTask(FROM_HERE, base::BindBlock(^{ TaskOrderMarker marker(this, "Timed"); run_time = base::TimeTicks::Now(); - (&message_loop_)->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure()); + (&message_loop_)->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); }), delta); task_runner_->PostTask(FROM_HERE, BoundRecordTaskOrder(this, "Second")); message_loop_.Run(); diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc index ec182d1..93996e6 100644 --- a/base/message_loop_unittest.cc +++ b/base/message_loop_unittest.cc @@ -1420,7 +1420,7 @@ void RunTest_RecursivePosts(MessageLoop::Type message_loop_type, #if defined(OS_WIN) -class DispatcherImpl : public MessageLoopForUI::Dispatcher { +class DispatcherImpl : public base::MessageLoopForUI::Dispatcher { public: DispatcherImpl() : dispatch_count_(0) {} diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index babe40a..3e26fc6 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -79,7 +79,7 @@ void PrefService::InitFromStorage(bool async) { read_error_callback_.Run(user_pref_store_->ReadPrefs()); } else { // Guarantee that initialization happens after this function returned. - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&PersistentPrefStore::ReadPrefsAsync, user_pref_store_.get(), diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc index 28696d9..5945e32 100644 --- a/base/threading/thread_unittest.cc +++ b/base/threading/thread_unittest.cc @@ -88,7 +88,8 @@ class CaptureToEventList : public Thread { // Observer that writes a value into |event_list| when a message loop has been // destroyed. -class CapturingDestructionObserver : public MessageLoop::DestructionObserver { +class CapturingDestructionObserver + : public base::MessageLoop::DestructionObserver { public: // |event_list| must remain valid throughout the observer's lifetime. explicit CapturingDestructionObserver(EventList* event_list) @@ -106,8 +107,9 @@ class CapturingDestructionObserver : public MessageLoop::DestructionObserver { }; // Task that adds a destruction observer to the current message loop. -void RegisterDestructionObserver(MessageLoop::DestructionObserver* observer) { - MessageLoop::current()->AddDestructionObserver(observer); +void RegisterDestructionObserver( + base::MessageLoop::DestructionObserver* observer) { + base::MessageLoop::current()->AddDestructionObserver(observer); } } // namespace diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc index 1751a38..9fe21a4 100644 --- a/base/timer_unittest.cc +++ b/base/timer_unittest.cc @@ -12,11 +12,11 @@ using base::TimeDelta; namespace { // The message loops on which each timer should be tested. -const MessageLoop::Type testing_message_loops[] = { - MessageLoop::TYPE_DEFAULT, - MessageLoop::TYPE_IO, +const base::MessageLoop::Type testing_message_loops[] = { + base::MessageLoop::TYPE_DEFAULT, + base::MessageLoop::TYPE_IO, #if !defined(OS_IOS) // iOS does not allow direct running of the UI loop. - MessageLoop::TYPE_UI, + base::MessageLoop::TYPE_UI, #endif }; @@ -35,7 +35,7 @@ class OneShotTimerTester { private: void Run() { *did_run_ = true; - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); } bool* did_run_; base::OneShotTimer<OneShotTimerTester> timer_; @@ -56,7 +56,7 @@ class OneShotSelfDeletingTimerTester { void Run() { *did_run_ = true; timer_.reset(); - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); } bool* did_run_; scoped_ptr<base::OneShotTimer<OneShotSelfDeletingTimerTester> > timer_; @@ -76,7 +76,7 @@ class RepeatingTimerTester { void Run() { if (--counter_ == 0) { *did_run_ = true; - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); } } bool* did_run_; @@ -84,26 +84,26 @@ class RepeatingTimerTester { base::RepeatingTimer<RepeatingTimerTester> timer_; }; -void RunTest_OneShotTimer(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_OneShotTimer(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); bool did_run = false; OneShotTimerTester f(&did_run); f.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(did_run); } -void RunTest_OneShotTimer_Cancel(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_OneShotTimer_Cancel(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); bool did_run_a = false; OneShotTimerTester* a = new OneShotTimerTester(&did_run_a); // This should run before the timer expires. - MessageLoop::current()->DeleteSoon(FROM_HERE, a); + base::MessageLoop::current()->DeleteSoon(FROM_HERE, a); // Now start the timer. a->Start(); @@ -112,44 +112,45 @@ void RunTest_OneShotTimer_Cancel(MessageLoop::Type message_loop_type) { OneShotTimerTester b(&did_run_b); b.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(did_run_a); EXPECT_TRUE(did_run_b); } -void RunTest_OneShotSelfDeletingTimer(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_OneShotSelfDeletingTimer( + base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); bool did_run = false; OneShotSelfDeletingTimerTester f(&did_run); f.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(did_run); } -void RunTest_RepeatingTimer(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_RepeatingTimer(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); bool did_run = false; RepeatingTimerTester f(&did_run); f.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(did_run); } -void RunTest_RepeatingTimer_Cancel(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_RepeatingTimer_Cancel(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); bool did_run_a = false; RepeatingTimerTester* a = new RepeatingTimerTester(&did_run_a); // This should run before the timer expires. - MessageLoop::current()->DeleteSoon(FROM_HERE, a); + base::MessageLoop::current()->DeleteSoon(FROM_HERE, a); // Now start the timer. a->Start(); @@ -158,7 +159,7 @@ void RunTest_RepeatingTimer_Cancel(MessageLoop::Type message_loop_type) { RepeatingTimerTester b(&did_run_b); b.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(did_run_a); EXPECT_TRUE(did_run_b); @@ -181,8 +182,8 @@ class DelayTimerTarget { bool signaled_; }; -void RunTest_DelayTimer_NoCall(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_DelayTimer_NoCall(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); // If Delay is never called, the timer shouldn't go off. DelayTimerTarget target; @@ -192,13 +193,13 @@ void RunTest_DelayTimer_NoCall(MessageLoop::Type message_loop_type) { bool did_run = false; OneShotTimerTester tester(&did_run); tester.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_FALSE(target.signaled()); } -void RunTest_DelayTimer_OneCall(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_DelayTimer_OneCall(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); DelayTimerTarget target; base::DelayTimer<DelayTimerTarget> timer(FROM_HERE, @@ -208,7 +209,7 @@ void RunTest_DelayTimer_OneCall(MessageLoop::Type message_loop_type) { bool did_run = false; OneShotTimerTester tester(&did_run, 100 /* milliseconds */); tester.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_TRUE(target.signaled()); } @@ -230,8 +231,8 @@ struct ResetHelper { DelayTimerTarget *const target_; }; -void RunTest_DelayTimer_Reset(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_DelayTimer_Reset(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); // If Delay is never called, the timer shouldn't go off. DelayTimerTarget target; @@ -250,7 +251,7 @@ void RunTest_DelayTimer_Reset(MessageLoop::Type message_loop_type) { bool did_run = false; OneShotTimerTester tester(&did_run, 300); tester.Start(); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); ASSERT_TRUE(target.signaled()); } @@ -263,8 +264,8 @@ class DelayTimerFatalTarget { }; -void RunTest_DelayTimer_Deleted(MessageLoop::Type message_loop_type) { - MessageLoop loop(message_loop_type); +void RunTest_DelayTimer_Deleted(base::MessageLoop::Type message_loop_type) { + base::MessageLoop loop(message_loop_type); DelayTimerFatalTarget target; @@ -355,7 +356,7 @@ TEST(TimerTest, MessageLoopShutdown) { OneShotTimerTester c(&did_run); OneShotTimerTester d(&did_run); { - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); a.Start(); b.Start(); } // MessageLoop destructs by falling out of scope. @@ -369,7 +370,7 @@ void TimerTestCallback() { TEST(TimerTest, NonRepeatIsRunning) { { - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); base::Timer timer(false, false); EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), @@ -382,7 +383,7 @@ TEST(TimerTest, NonRepeatIsRunning) { { base::Timer timer(true, false); - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), base::Bind(&TimerTestCallback)); @@ -398,7 +399,7 @@ TEST(TimerTest, NonRepeatIsRunning) { TEST(TimerTest, NonRepeatMessageLoopDeath) { base::Timer timer(false, false); { - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); EXPECT_FALSE(timer.IsRunning()); timer.Start(FROM_HERE, TimeDelta::FromDays(1), base::Bind(&TimerTestCallback)); @@ -409,7 +410,7 @@ TEST(TimerTest, NonRepeatMessageLoopDeath) { } TEST(TimerTest, RetainRepeatIsRunning) { - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); base::Timer timer(FROM_HERE, TimeDelta::FromDays(1), base::Bind(&TimerTestCallback), true); EXPECT_FALSE(timer.IsRunning()); @@ -422,7 +423,7 @@ TEST(TimerTest, RetainRepeatIsRunning) { } TEST(TimerTest, RetainNonRepeatIsRunning) { - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); base::Timer timer(FROM_HERE, TimeDelta::FromDays(1), base::Bind(&TimerTestCallback), false); EXPECT_FALSE(timer.IsRunning()); @@ -446,25 +447,25 @@ void ClearAllCallbackHappened() { void SetCallbackHappened1() { g_callback_happened1 = true; - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); } void SetCallbackHappened2() { g_callback_happened2 = true; - MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdle(); } TEST(TimerTest, ContinuationStopStart) { { ClearAllCallbackHappened(); - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); base::Timer timer(false, false); timer.Start(FROM_HERE, TimeDelta::FromMilliseconds(10), base::Bind(&SetCallbackHappened1)); timer.Stop(); timer.Start(FROM_HERE, TimeDelta::FromMilliseconds(40), base::Bind(&SetCallbackHappened2)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_FALSE(g_callback_happened1); EXPECT_TRUE(g_callback_happened2); } @@ -473,14 +474,14 @@ TEST(TimerTest, ContinuationStopStart) { TEST(TimerTest, ContinuationReset) { { ClearAllCallbackHappened(); - MessageLoop loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); base::Timer timer(false, false); timer.Start(FROM_HERE, TimeDelta::FromMilliseconds(10), base::Bind(&SetCallbackHappened1)); timer.Reset(); // Since Reset happened before task ran, the user_task must not be cleared: ASSERT_FALSE(timer.user_task().is_null()); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(g_callback_happened1); } } |