This source file includes following definitions.
- TEST
#include "base/timer/hi_res_timer_manager.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_monitor_device_source.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
#if defined(OS_WIN)
TEST(HiResTimerManagerTest, DISABLED_ToggleOnOff) {
base::MessageLoop loop;
scoped_ptr<base::PowerMonitorSource> power_monitor_source(
new base::PowerMonitorDeviceSource());
scoped_ptr<base::PowerMonitor> power_monitor(
new base::PowerMonitor(power_monitor_source.Pass()));
HighResolutionTimerManager manager;
manager.OnPowerStateChange( false);
for (int loop = 2; loop >= 0; --loop) {
EXPECT_TRUE(manager.hi_res_clock_available());
EXPECT_FALSE(base::Time::IsHighResolutionTimerInUse());
base::Time::ActivateHighResolutionTimer(true);
EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse());
manager.OnPowerStateChange( true);
EXPECT_FALSE(manager.hi_res_clock_available());
EXPECT_FALSE(base::Time::IsHighResolutionTimerInUse());
manager.OnPowerStateChange( false);
EXPECT_TRUE(manager.hi_res_clock_available());
EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse());
base::Time::ActivateHighResolutionTimer(false);
}
}
#endif
}