| OLD | NEW |
| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 .Times(AnyNumber()) | 204 .Times(AnyNumber()) |
| 205 .WillRepeatedly((Return(false))) | 205 .WillRepeatedly((Return(false))) |
| 206 .RetiresOnSaturation(); | 206 .RetiresOnSaturation(); |
| 207 | 207 |
| 208 // NetworkMenu::InitMenuItems() calls: | 208 // NetworkMenu::InitMenuItems() calls: |
| 209 EXPECT_CALL(*mock_network_library_, IsLocked()) | 209 EXPECT_CALL(*mock_network_library_, IsLocked()) |
| 210 .Times(AnyNumber()) | 210 .Times(AnyNumber()) |
| 211 .WillRepeatedly((Return(false))) | 211 .WillRepeatedly((Return(false))) |
| 212 .RetiresOnSaturation(); | 212 .RetiresOnSaturation(); |
| 213 EXPECT_CALL(*mock_network_library_, ethernet_connected()) | 213 EXPECT_CALL(*mock_network_library_, ethernet_connected()) |
| 214 .Times(1) | 214 .Times(AnyNumber()) |
| 215 .WillRepeatedly((Return(false))) | 215 .WillRepeatedly((Return(false))) |
| 216 .RetiresOnSaturation(); | 216 .RetiresOnSaturation(); |
| 217 EXPECT_CALL(*mock_network_library_, ethernet_connecting()) | 217 EXPECT_CALL(*mock_network_library_, ethernet_connecting()) |
| 218 .Times(1) | 218 .Times(AnyNumber()) |
| 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(AnyNumber()) |
| 226 .RetiresOnSaturation(); | 226 .RetiresOnSaturation(); |
| 227 EXPECT_CALL(*mock_power_library_, RemoveObserver(_)) | 227 EXPECT_CALL(*mock_power_library_, RemoveObserver(_)) |
| 228 .Times(3) | 228 .Times(AnyNumber()) |
| 229 .RetiresOnSaturation(); | 229 .RetiresOnSaturation(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void CrosMock::SetPowerLibraryExpectations() { | 232 void CrosMock::SetPowerLibraryExpectations() { |
| 233 // EnableScreenLock is currently bounded with a prefs value and thus is | 233 // EnableScreenLock is currently bounded with a prefs value and thus is |
| 234 // always called when loading | 234 // always called when loading |
| 235 EXPECT_CALL(*mock_power_library_, EnableScreenLock(_)) | 235 EXPECT_CALL(*mock_power_library_, EnableScreenLock(_)) |
| 236 .Times(AnyNumber()); | 236 .Times(AnyNumber()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void CrosMock::TearDownMocks() { | 239 void CrosMock::TearDownMocks() { |
| 240 // Prevent bogus gMock leak check from firing. | 240 // Prevent bogus gMock leak check from firing. |
| 241 if (loader_) | 241 if (loader_) |
| 242 test_api()->SetLibraryLoader(NULL, false); | 242 test_api()->SetLibraryLoader(NULL, false); |
| 243 if (mock_cryptohome_library_) | 243 if (mock_cryptohome_library_) |
| 244 test_api()->SetCryptohomeLibrary(NULL, false); | 244 test_api()->SetCryptohomeLibrary(NULL, false); |
| 245 if (mock_network_library_) | 245 if (mock_network_library_) |
| 246 test_api()->SetNetworkLibrary(NULL, false); | 246 test_api()->SetNetworkLibrary(NULL, false); |
| 247 if (mock_power_library_) | 247 if (mock_power_library_) |
| 248 test_api()->SetPowerLibrary(NULL, false); | 248 test_api()->SetPowerLibrary(NULL, false); |
| 249 if (mock_screen_lock_library_) | 249 if (mock_screen_lock_library_) |
| 250 test_api()->SetScreenLockLibrary(NULL, false); | 250 test_api()->SetScreenLockLibrary(NULL, false); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace chromeos | 253 } // namespace chromeos |
| OLD | NEW |