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

Unified Diff: base/message_loop/message_loop_unittest.cc

Issue 17567007: Made MessagePump a non-thread safe class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
Index: base/message_loop/message_loop_unittest.cc
diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc
index 504c8e30b6b72c7093ea211469c82306dbe5eeba..ab05b3cb5abcdc465d0e52b9a303d0ffcb6c724b 100644
--- a/base/message_loop/message_loop_unittest.cc
+++ b/base/message_loop/message_loop_unittest.cc
@@ -10,6 +10,7 @@
#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"
@@ -26,19 +27,6 @@
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.
@@ -121,10 +109,10 @@ void RunTest_PostTask(MessageLoop::Type message_loop_type) {
thread.Start();
thread.message_loop()->PostTask(
FROM_HERE,
- Bind(&MessageLoopLockTest::LockWaitUnLock,
- MessageLoop::current(),
- &wait,
- &signal));
+ Bind(&MessageLoop::LockWaitUnLockForTesting,
+ base::Unretained(MessageLoop::current()),
+ &wait,
+ &signal));
wait.Wait();
EXPECT_FALSE(MessageLoop::current()->TryPostTask(FROM_HERE, Bind(
@@ -1895,20 +1883,20 @@ TEST(MessageLoopTest, HighResolutionTimer) {
const TimeDelta kFastTimer = TimeDelta::FromMilliseconds(5);
const TimeDelta kSlowTimer = TimeDelta::FromMilliseconds(100);
- EXPECT_FALSE(loop.high_resolution_timers_enabled());
+ EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
// Post a fast task to enable the high resolution timers.
loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
kFastTimer);
loop.Run();
- EXPECT_TRUE(loop.high_resolution_timers_enabled());
+ EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting());
// 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.high_resolution_timers_enabled());
+ EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting());
// Wait for a while so that high-resolution mode elapses.
PlatformThread::Sleep(TimeDelta::FromMilliseconds(
@@ -1918,7 +1906,7 @@ TEST(MessageLoopTest, HighResolutionTimer) {
loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
kSlowTimer);
loop.Run();
- EXPECT_FALSE(loop.high_resolution_timers_enabled());
+ EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
}
#endif // defined(OS_WIN)

Powered by Google App Engine
This is Rietveld 408576698