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

Unified Diff: base/message_loop_unittest.cc

Issue 2822035: Change chrome from statically enabling high resolution timers on windows... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « base/message_loop.cc ('k') | base/test/test_suite.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop_unittest.cc
===================================================================
--- base/message_loop_unittest.cc (revision 51045)
+++ base/message_loop_unittest.cc (working copy)
@@ -1539,6 +1539,35 @@
TEST(MessageLoopTest, WaitForIO) {
RunTest_WaitForIO();
}
+
+TEST(MessageLoopTest, HighResolutionTimer) {
+ MessageLoop loop;
+
+ const int kFastTimerMs = 5;
+ const int kSlowTimerMs = 100;
+
+ EXPECT_EQ(false, loop.high_resolution_timers_enabled());
+
+ // Post a fast task to enable the high resolution timers.
+ loop.PostDelayedTask(FROM_HERE, new DummyTask(1), kFastTimerMs);
+ loop.Run();
+ EXPECT_EQ(true, loop.high_resolution_timers_enabled());
+
+ // Post a slow task and verify high resolution timers
+ // are still enabled.
+ loop.PostDelayedTask(FROM_HERE, new DummyTask(1), kSlowTimerMs);
+ loop.Run();
+ EXPECT_EQ(true, loop.high_resolution_timers_enabled());
+
+ // Wait for a while so that high-resolution mode elapses.
+ Sleep(MessageLoop::kHighResolutionTimerModeLeaseTimeMs);
+
+ // Post a slow task to disable the high resolution timers.
+ loop.PostDelayedTask(FROM_HERE, new DummyTask(1), kSlowTimerMs);
+ loop.Run();
+ EXPECT_EQ(false, loop.high_resolution_timers_enabled());
+}
+
#endif // defined(OS_WIN)
#if defined(OS_POSIX)
« no previous file with comments | « base/message_loop.cc ('k') | base/test/test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698