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/time/time.h" | 11 #include "base/time/time.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
16 // http://crbug.com/114048 | 17 // http://crbug.com/114048 |
17 TEST(HiResTimerManagerTest, DISABLED_ToggleOnOff) { | 18 TEST(HiResTimerManagerTest, DISABLED_ToggleOnOff) { |
18 base::MessageLoop loop; | 19 base::MessageLoop loop; |
19 scoped_ptr<base::PowerMonitor> power_monitor(new base::PowerMonitor()); | 20 scoped_ptr<base::PowerMonitorSource> power_monitor_source( |
| 21 new base::PowerMonitorDeviceSource()); |
| 22 scoped_ptr<base::PowerMonitor> power_monitor( |
| 23 new base::PowerMonitor(power_monitor_source.Pass())); |
20 HighResolutionTimerManager manager; | 24 HighResolutionTimerManager manager; |
21 | 25 |
22 // At this point, we don't know if the high resolution timers are on or off, | 26 // At this point, we don't know if the high resolution timers are on or off, |
23 // it depends on what system the tests are running on (for example, if this | 27 // it depends on what system the tests are running on (for example, if this |
24 // test is running on a laptop/battery, then the PowerMonitor would have | 28 // test is running on a laptop/battery, then the PowerMonitor would have |
25 // already set the PowerState to battery power; but if we're running on a | 29 // already set the PowerState to battery power; but if we're running on a |
26 // desktop, then the PowerState will be non-battery power). Simulate a power | 30 // desktop, then the PowerState will be non-battery power). Simulate a power |
27 // level change to get to a deterministic state. | 31 // level change to get to a deterministic state. |
28 manager.OnPowerStateChange(/* on_battery */ false); | 32 manager.OnPowerStateChange(/* on_battery */ false); |
29 | 33 |
(...skipping 18 matching lines...) Expand all Loading... |
48 EXPECT_TRUE(manager.hi_res_clock_available()); | 52 EXPECT_TRUE(manager.hi_res_clock_available()); |
49 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse()); | 53 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse()); |
50 | 54 |
51 // De-activate the high resolution timer. | 55 // De-activate the high resolution timer. |
52 base::Time::ActivateHighResolutionTimer(false); | 56 base::Time::ActivateHighResolutionTimer(false); |
53 } | 57 } |
54 } | 58 } |
55 #endif // defined(OS_WIN) | 59 #endif // defined(OS_WIN) |
56 | 60 |
57 } // namespace base | 61 } // namespace base |
OLD | NEW |