OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/timer/hi_res_timer_manager.h" | 5 #include "base/timer/hi_res_timer_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/power_monitor/power_monitor.h" | 9 #include "base/power_monitor/power_monitor.h" |
10 #include "base/power_monitor/power_monitor_device_source.h" | 10 #include "base/power_monitor/power_monitor_device_source.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/googletest/include/gtest/gtest.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
17 TEST(HiResTimerManagerTest, ToggleOnOff) { | 17 TEST(HiResTimerManagerTest, ToggleOnOff) { |
18 // The power monitor creates Window to receive power notifications from | 18 // The power monitor creates Window to receive power notifications from |
19 // Windows, which makes this test flaky if you run while the machine | 19 // Windows, which makes this test flaky if you run while the machine |
20 // goes in or out of AC power. | 20 // goes in or out of AC power. |
21 base::MessageLoop loop(base::MessageLoop::TYPE_UI); | 21 base::MessageLoop loop(base::MessageLoop::TYPE_UI); |
22 scoped_ptr<base::PowerMonitorSource> power_monitor_source( | 22 scoped_ptr<base::PowerMonitorSource> power_monitor_source( |
(...skipping 26 matching lines...) Expand all Loading... |
49 EXPECT_TRUE(manager.hi_res_clock_available()); | 49 EXPECT_TRUE(manager.hi_res_clock_available()); |
50 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse()); | 50 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse()); |
51 | 51 |
52 // De-activate the high resolution timer. | 52 // De-activate the high resolution timer. |
53 base::Time::ActivateHighResolutionTimer(false); | 53 base::Time::ActivateHighResolutionTimer(false); |
54 } | 54 } |
55 } | 55 } |
56 #endif // defined(OS_WIN) | 56 #endif // defined(OS_WIN) |
57 | 57 |
58 } // namespace base | 58 } // namespace base |
OLD | NEW |