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

Side by Side Diff: base/timer/hi_res_timer_manager_unittest.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years 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 unified diff | Download patch
« no previous file with comments | « base/test/values_test_util.cc ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility>
8
7 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
9 #include "base/power_monitor/power_monitor.h" 11 #include "base/power_monitor/power_monitor.h"
10 #include "base/power_monitor/power_monitor_device_source.h" 12 #include "base/power_monitor/power_monitor_device_source.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace base { 16 namespace base {
15 17
16 #if defined(OS_WIN) 18 #if defined(OS_WIN)
17 TEST(HiResTimerManagerTest, ToggleOnOff) { 19 TEST(HiResTimerManagerTest, ToggleOnOff) {
18 // The power monitor creates Window to receive power notifications from 20 // The power monitor creates Window to receive power notifications from
19 // Windows, which makes this test flaky if you run while the machine 21 // Windows, which makes this test flaky if you run while the machine
20 // goes in or out of AC power. 22 // goes in or out of AC power.
21 base::MessageLoop loop(base::MessageLoop::TYPE_UI); 23 base::MessageLoop loop(base::MessageLoop::TYPE_UI);
22 scoped_ptr<base::PowerMonitorSource> power_monitor_source( 24 scoped_ptr<base::PowerMonitorSource> power_monitor_source(
23 new base::PowerMonitorDeviceSource()); 25 new base::PowerMonitorDeviceSource());
24 scoped_ptr<base::PowerMonitor> power_monitor( 26 scoped_ptr<base::PowerMonitor> power_monitor(
25 new base::PowerMonitor(power_monitor_source.Pass())); 27 new base::PowerMonitor(std::move(power_monitor_source)));
26 28
27 HighResolutionTimerManager manager; 29 HighResolutionTimerManager manager;
28 // Simulate a on-AC power event to get to a known initial state. 30 // Simulate a on-AC power event to get to a known initial state.
29 manager.OnPowerStateChange(false); 31 manager.OnPowerStateChange(false);
30 32
31 // Loop a few times to test power toggling. 33 // Loop a few times to test power toggling.
32 for (int times = 0; times != 3; ++times) { 34 for (int times = 0; times != 3; ++times) {
33 // The manager has the high resolution clock enabled now. 35 // The manager has the high resolution clock enabled now.
34 EXPECT_TRUE(manager.hi_res_clock_available()); 36 EXPECT_TRUE(manager.hi_res_clock_available());
35 // But the Time class has it off, because it hasn't been activated. 37 // But the Time class has it off, because it hasn't been activated.
(...skipping 13 matching lines...) Expand all
49 EXPECT_TRUE(manager.hi_res_clock_available()); 51 EXPECT_TRUE(manager.hi_res_clock_available());
50 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse()); 52 EXPECT_TRUE(base::Time::IsHighResolutionTimerInUse());
51 53
52 // De-activate the high resolution timer. 54 // De-activate the high resolution timer.
53 base::Time::ActivateHighResolutionTimer(false); 55 base::Time::ActivateHighResolutionTimer(false);
54 } 56 }
55 } 57 }
56 #endif // defined(OS_WIN) 58 #endif // defined(OS_WIN)
57 59
58 } // namespace base 60 } // namespace base
OLDNEW
« no previous file with comments | « base/test/values_test_util.cc ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698