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

Unified Diff: base/message_loop/message_loop_unittest.cc

Issue 395913006: High resolution timer fix for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: real fixes for review Created 6 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 1b09eb070fa32d1ffeed9555e24aae673f795463..866c20bc7bdbb4f40c1664d809e4e987e3c77417 100644
--- a/base/message_loop/message_loop_unittest.cc
+++ b/base/message_loop/message_loop_unittest.cc
@@ -730,30 +730,20 @@ TEST(MessageLoopTest, HighResolutionTimer) {
const TimeDelta kFastTimer = TimeDelta::FromMilliseconds(5);
const TimeDelta kSlowTimer = TimeDelta::FromMilliseconds(100);
- EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
-
+ EXPECT_FALSE(loop.HasHighResolutionTasks());
// 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_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.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.
+ EXPECT_FALSE(loop.HasHighResolutionTasks());
+ EXPECT_FALSE(Time::IsHighResolutionTimerInUse());
+ // Check that a slow task does not trigger the high resolution logic.
loop.PostDelayedTask(FROM_HERE, Bind(&PostNTasksThenQuit, 1),
kSlowTimer);
+ EXPECT_FALSE(loop.HasHighResolutionTasks());
loop.Run();
- EXPECT_FALSE(loop.IsHighResolutionTimerEnabledForTesting());
+ EXPECT_FALSE(loop.HasHighResolutionTasks());
}
#endif // defined(OS_WIN)

Powered by Google App Engine
This is Rietveld 408576698