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

Side by Side Diff: device/battery/battery_status_service_unittest.cc

Issue 1544323002: Convert Pass()→std::move() in //device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months 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 | « device/battery/battery_status_service.cc ('k') | device/bluetooth/bluetooth_adapter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/battery/battery_status_service.h"
6
7 #include <utility>
8
5 #include "base/bind.h" 9 #include "base/bind.h"
6 #include "base/macros.h" 10 #include "base/macros.h"
7 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 12 #include "base/run_loop.h"
9 #include "device/battery/battery_status_manager.h" 13 #include "device/battery/battery_status_manager.h"
10 #include "device/battery/battery_status_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 15
13 namespace device { 16 namespace device {
14 17
15 namespace { 18 namespace {
16 19
17 class FakeBatteryManager : public BatteryStatusManager { 20 class FakeBatteryManager : public BatteryStatusManager {
18 public: 21 public:
19 explicit FakeBatteryManager( 22 explicit FakeBatteryManager(
20 const BatteryStatusService::BatteryUpdateCallback& callback) 23 const BatteryStatusService::BatteryUpdateCallback& callback)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 base::Unretained(this)); 65 base::Unretained(this));
63 callback2_ = base::Bind(&BatteryStatusServiceTest::Callback2, 66 callback2_ = base::Bind(&BatteryStatusServiceTest::Callback2,
64 base::Unretained(this)); 67 base::Unretained(this));
65 68
66 // We keep a raw pointer to the FakeBatteryManager, which we expect to 69 // We keep a raw pointer to the FakeBatteryManager, which we expect to
67 // remain valid for the lifetime of the BatteryStatusService. 70 // remain valid for the lifetime of the BatteryStatusService.
68 scoped_ptr<FakeBatteryManager> battery_manager( 71 scoped_ptr<FakeBatteryManager> battery_manager(
69 new FakeBatteryManager(battery_service_.GetUpdateCallbackForTesting())); 72 new FakeBatteryManager(battery_service_.GetUpdateCallbackForTesting()));
70 battery_manager_ = battery_manager.get(); 73 battery_manager_ = battery_manager.get();
71 74
72 battery_service_.SetBatteryManagerForTesting(battery_manager.Pass()); 75 battery_service_.SetBatteryManagerForTesting(std::move(battery_manager));
73 } 76 }
74 77
75 void TearDown() override { 78 void TearDown() override {
76 base::RunLoop().RunUntilIdle(); 79 base::RunLoop().RunUntilIdle();
77 } 80 }
78 81
79 FakeBatteryManager* battery_manager() { 82 FakeBatteryManager* battery_manager() {
80 return battery_manager_; 83 return battery_manager_;
81 } 84 }
82 85
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EXPECT_EQ(1, callback2_invoked_count()); 184 EXPECT_EQ(1, callback2_invoked_count());
182 185
183 subscription1.reset(); 186 subscription1.reset();
184 battery_manager()->InvokeUpdateCallback(status); 187 battery_manager()->InvokeUpdateCallback(status);
185 base::RunLoop().RunUntilIdle(); 188 base::RunLoop().RunUntilIdle();
186 EXPECT_EQ(1, callback1_invoked_count()); 189 EXPECT_EQ(1, callback1_invoked_count());
187 EXPECT_EQ(2, callback2_invoked_count()); 190 EXPECT_EQ(2, callback2_invoked_count());
188 } 191 }
189 192
190 } // namespace device 193 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_status_service.cc ('k') | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698