| Index: trunk/src/base/message_loop/message_loop_unittest.cc
|
| ===================================================================
|
| --- trunk/src/base/message_loop/message_loop_unittest.cc (revision 212951)
|
| +++ trunk/src/base/message_loop/message_loop_unittest.cc (working copy)
|
| @@ -10,7 +10,6 @@
|
| #include "base/logging.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/message_loop/message_loop.h"
|
| -#include "base/message_loop/message_loop_proxy_impl.h"
|
| #include "base/pending_task.h"
|
| #include "base/posix/eintr_wrapper.h"
|
| #include "base/run_loop.h"
|
| @@ -27,6 +26,19 @@
|
|
|
| namespace base {
|
|
|
| +class MessageLoopLockTest {
|
| + public:
|
| + static void LockWaitUnLock(MessageLoop* loop,
|
| + WaitableEvent* caller_wait,
|
| + WaitableEvent* caller_signal) {
|
| +
|
| + loop->incoming_queue_lock_.Acquire();
|
| + caller_wait->Signal();
|
| + caller_signal->Wait();
|
| + loop->incoming_queue_lock_.Release();
|
| + }
|
| +};
|
| +
|
| // TODO(darin): Platform-specific MessageLoop tests should be grouped together
|
| // to avoid chopping this file up with so many #ifdefs.
|
|
|
| @@ -109,10 +121,10 @@
|
| thread.Start();
|
| thread.message_loop()->PostTask(
|
| FROM_HERE,
|
| - Bind(&MessageLoop::LockWaitUnLockForTesting,
|
| - base::Unretained(MessageLoop::current()),
|
| - &wait,
|
| - &signal));
|
| + Bind(&MessageLoopLockTest::LockWaitUnLock,
|
| + MessageLoop::current(),
|
| + &wait,
|
| + &signal));
|
|
|
| wait.Wait();
|
| EXPECT_FALSE(MessageLoop::current()->TryPostTask(FROM_HERE, Bind(
|
| @@ -1883,20 +1895,20 @@
|
| const TimeDelta kFastTimer = TimeDelta::FromMilliseconds(5);
|
| const TimeDelta kSlowTimer = TimeDelta::FromMilliseconds(100);
|
|
|
| - EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
|
| + EXPECT_FALSE(loop.high_resolution_timers_enabled());
|
|
|
| // Post a fast task to enable the high resolution timers.
|
| loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
|
| kFastTimer);
|
| loop.Run();
|
| - EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting());
|
| + EXPECT_TRUE(loop.high_resolution_timers_enabled());
|
|
|
| // Post a slow task and verify high resolution timers
|
| // are still enabled.
|
| loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
|
| kSlowTimer);
|
| loop.Run();
|
| - EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting());
|
| + EXPECT_TRUE(loop.high_resolution_timers_enabled());
|
|
|
| // Wait for a while so that high-resolution mode elapses.
|
| PlatformThread::Sleep(TimeDelta::FromMilliseconds(
|
| @@ -1906,7 +1918,7 @@
|
| loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
|
| kSlowTimer);
|
| loop.Run();
|
| - EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
|
| + EXPECT_FALSE(loop.high_resolution_timers_enabled());
|
| }
|
|
|
| #endif // defined(OS_WIN)
|
|
|