Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: trunk/src/base/message_loop/message_loop_unittest.cc

Issue 19737005: Revert 212948 "Made MessagePump a non-thread safe class." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/base/message_loop/message_loop_proxy_impl.cc ('k') | trunk/src/base/message_loop/message_pump.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « trunk/src/base/message_loop/message_loop_proxy_impl.cc ('k') | trunk/src/base/message_loop/message_pump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698