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