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 866c20bc7bdbb4f40c1664d809e4e987e3c77417..1b09eb070fa32d1ffeed9555e24aae673f795463 100644 |
--- a/base/message_loop/message_loop_unittest.cc |
+++ b/base/message_loop/message_loop_unittest.cc |
@@ -730,20 +730,30 @@ |
const TimeDelta kFastTimer = TimeDelta::FromMilliseconds(5); |
const TimeDelta kSlowTimer = TimeDelta::FromMilliseconds(100); |
- EXPECT_FALSE(loop.HasHighResolutionTasks()); |
+ EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting()); |
+ |
// Post a fast task to enable the high resolution timers. |
loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1), |
kFastTimer); |
- EXPECT_TRUE(loop.HasHighResolutionTasks()); |
loop.Run(); |
- EXPECT_FALSE(loop.HasHighResolutionTasks()); |
- EXPECT_FALSE(Time::IsHighResolutionTimerInUse()); |
- // Check that a slow task does not trigger the high resolution logic. |
+ EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting()); |
+ |
+ // Post a slow task and verify high resolution timers |
+ // are still enabled. |
loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1), |
kSlowTimer); |
- EXPECT_FALSE(loop.HasHighResolutionTasks()); |
loop.Run(); |
- EXPECT_FALSE(loop.HasHighResolutionTasks()); |
+ EXPECT_TRUE(loop.IsHighResolutionTimerEnabledForTesting()); |
+ |
+ // Wait for a while so that high-resolution mode elapses. |
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds( |
+ MessageLoop::kHighResolutionTimerModeLeaseTimeMs)); |
+ |
+ // Post a slow task to disable the high resolution timers. |
+ loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1), |
+ kSlowTimer); |
+ loop.Run(); |
+ EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting()); |
} |
#endif // defined(OS_WIN) |