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

Side by Side Diff: chrome/browser/chromeos/cros/cros_mock.cc

Issue 8347016: chromeos: Simplify power supply info in PowerLibrary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Various comment fixes Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/cros/cros_mock.h" 5 #include "chrome/browser/chromeos/cros/cros_mock.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 EXPECT_CALL(*mock_network_library_, ethernet_connecting()) 217 EXPECT_CALL(*mock_network_library_, ethernet_connecting())
218 .Times(1) 218 .Times(1)
219 .WillRepeatedly((Return(false))) 219 .WillRepeatedly((Return(false)))
220 .RetiresOnSaturation(); 220 .RetiresOnSaturation();
221 } 221 }
222 222
223 void CrosMock::SetPowerLibraryStatusAreaExpectations() { 223 void CrosMock::SetPowerLibraryStatusAreaExpectations() {
224 EXPECT_CALL(*mock_power_library_, AddObserver(_)) 224 EXPECT_CALL(*mock_power_library_, AddObserver(_))
225 .Times(3) 225 .Times(3)
226 .RetiresOnSaturation(); 226 .RetiresOnSaturation();
227 EXPECT_CALL(*mock_power_library_, IsBatteryFullyCharged())
228 .Times(1)
229 .WillRepeatedly((Return(false)))
230 .RetiresOnSaturation();
231 EXPECT_CALL(*mock_power_library_, IsBatteryPresent())
232 .Times(1)
233 .WillOnce((Return(true)))
234 .RetiresOnSaturation();
235 EXPECT_CALL(*mock_power_library_, GetBatteryPercentage())
236 .Times(1)
237 .WillRepeatedly((Return(42.0)))
238 .RetiresOnSaturation();
239 EXPECT_CALL(*mock_power_library_, IsLinePowerOn())
240 .Times(1)
241 .WillRepeatedly((Return(false)))
242 .RetiresOnSaturation();
243 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToEmpty())
244 .Times(1)
245 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(42))))
246 .RetiresOnSaturation();
247 EXPECT_CALL(*mock_power_library_, GetBatteryTimeToFull())
248 .Times(1)
249 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(24))))
250 .RetiresOnSaturation();
251 EXPECT_CALL(*mock_power_library_, RemoveObserver(_)) 227 EXPECT_CALL(*mock_power_library_, RemoveObserver(_))
252 .Times(3) 228 .Times(3)
253 .RetiresOnSaturation(); 229 .RetiresOnSaturation();
254 } 230 }
255 231
256 void CrosMock::SetPowerLibraryExpectations() { 232 void CrosMock::SetPowerLibraryExpectations() {
257 // EnableScreenLock is currently bounded with a prefs value and thus is 233 // EnableScreenLock is currently bounded with a prefs value and thus is
258 // always called when loading 234 // always called when loading
259 EXPECT_CALL(*mock_power_library_, EnableScreenLock(_)) 235 EXPECT_CALL(*mock_power_library_, EnableScreenLock(_))
260 .Times(AnyNumber()); 236 .Times(AnyNumber());
261 } 237 }
262 238
263 void CrosMock::TearDownMocks() { 239 void CrosMock::TearDownMocks() {
264 // Prevent bogus gMock leak check from firing. 240 // Prevent bogus gMock leak check from firing.
265 if (loader_) 241 if (loader_)
266 test_api()->SetLibraryLoader(NULL, false); 242 test_api()->SetLibraryLoader(NULL, false);
267 if (mock_cryptohome_library_) 243 if (mock_cryptohome_library_)
268 test_api()->SetCryptohomeLibrary(NULL, false); 244 test_api()->SetCryptohomeLibrary(NULL, false);
269 if (mock_network_library_) 245 if (mock_network_library_)
270 test_api()->SetNetworkLibrary(NULL, false); 246 test_api()->SetNetworkLibrary(NULL, false);
271 if (mock_power_library_) 247 if (mock_power_library_)
272 test_api()->SetPowerLibrary(NULL, false); 248 test_api()->SetPowerLibrary(NULL, false);
273 if (mock_screen_lock_library_) 249 if (mock_screen_lock_library_)
274 test_api()->SetScreenLockLibrary(NULL, false); 250 test_api()->SetScreenLockLibrary(NULL, false);
275 } 251 }
276 252
277 } // namespace chromeos 253 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider_chromeos.cc ('k') | chrome/browser/chromeos/cros/mock_power_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698