| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 MockTouchpadLibrary* CrosMock::mock_touchpad_library() { | 182 MockTouchpadLibrary* CrosMock::mock_touchpad_library() { |
| 183 return mock_touchpad_library_; | 183 return mock_touchpad_library_; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void CrosMock::SetStatusAreaMocksExpectations() { | 186 void CrosMock::SetStatusAreaMocksExpectations() { |
| 187 SetKeyboardLibraryStatusAreaExpectations(); | 187 SetKeyboardLibraryStatusAreaExpectations(); |
| 188 SetInputMethodLibraryStatusAreaExpectations(); | 188 SetInputMethodLibraryStatusAreaExpectations(); |
| 189 SetNetworkLibraryStatusAreaExpectations(); | 189 SetNetworkLibraryStatusAreaExpectations(); |
| 190 SetPowerLibraryStatusAreaExpectations(); | 190 SetPowerLibraryStatusAreaExpectations(); |
| 191 SetPowerLibraryExpectations(); |
| 191 SetTouchpadLibraryExpectations(); | 192 SetTouchpadLibraryExpectations(); |
| 192 SetSystemLibraryStatusAreaExpectations(); | 193 SetSystemLibraryStatusAreaExpectations(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void CrosMock::SetKeyboardLibraryStatusAreaExpectations() { | 196 void CrosMock::SetKeyboardLibraryStatusAreaExpectations() { |
| 196 EXPECT_CALL(*mock_keyboard_library_, GetHardwareKeyboardLayoutName()) | 197 EXPECT_CALL(*mock_keyboard_library_, GetHardwareKeyboardLayoutName()) |
| 197 .Times(AnyNumber()) | 198 .Times(AnyNumber()) |
| 198 .WillRepeatedly((Return("xkb:us::eng"))) | 199 .WillRepeatedly((Return("xkb:us::eng"))) |
| 199 .RetiresOnSaturation(); | 200 .RetiresOnSaturation(); |
| 200 EXPECT_CALL(*mock_keyboard_library_, GetCurrentKeyboardLayoutName()) | 201 EXPECT_CALL(*mock_keyboard_library_, GetCurrentKeyboardLayoutName()) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 .RetiresOnSaturation(); | 330 .RetiresOnSaturation(); |
| 330 EXPECT_CALL(*mock_power_library_, battery_time_to_full()) | 331 EXPECT_CALL(*mock_power_library_, battery_time_to_full()) |
| 331 .Times(1) | 332 .Times(1) |
| 332 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(24)))) | 333 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(24)))) |
| 333 .RetiresOnSaturation(); | 334 .RetiresOnSaturation(); |
| 334 EXPECT_CALL(*mock_power_library_, RemoveObserver(_)) | 335 EXPECT_CALL(*mock_power_library_, RemoveObserver(_)) |
| 335 .Times(1) | 336 .Times(1) |
| 336 .RetiresOnSaturation(); | 337 .RetiresOnSaturation(); |
| 337 } | 338 } |
| 338 | 339 |
| 340 void CrosMock::SetPowerLibraryExpectations() { |
| 341 // EnableScreenLock is currently bounded with a prefs value and thus is |
| 342 // always called when loading |
| 343 EXPECT_CALL(*mock_power_library_, EnableScreenLock(_)) |
| 344 .Times(AnyNumber()); |
| 345 } |
| 346 |
| 339 void CrosMock::SetSpeechSynthesisLibraryExpectations() { | 347 void CrosMock::SetSpeechSynthesisLibraryExpectations() { |
| 340 EXPECT_CALL(*mock_speech_synthesis_library_, Speak(_)) | 348 EXPECT_CALL(*mock_speech_synthesis_library_, Speak(_)) |
| 341 .Times(1) | 349 .Times(1) |
| 342 .WillOnce(Return(true)) | 350 .WillOnce(Return(true)) |
| 343 .RetiresOnSaturation(); | 351 .RetiresOnSaturation(); |
| 344 EXPECT_CALL(*mock_speech_synthesis_library_, StopSpeaking()) | 352 EXPECT_CALL(*mock_speech_synthesis_library_, StopSpeaking()) |
| 345 .Times(1) | 353 .Times(1) |
| 346 .WillOnce(Return(true)) | 354 .WillOnce(Return(true)) |
| 347 .RetiresOnSaturation(); | 355 .RetiresOnSaturation(); |
| 348 EXPECT_CALL(*mock_speech_synthesis_library_, IsSpeaking()) | 356 EXPECT_CALL(*mock_speech_synthesis_library_, IsSpeaking()) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 test_api()->SetScreenLockLibrary(NULL, false); | 403 test_api()->SetScreenLockLibrary(NULL, false); |
| 396 if (mock_speech_synthesis_library_) | 404 if (mock_speech_synthesis_library_) |
| 397 test_api()->SetSpeechSynthesisLibrary(NULL, false); | 405 test_api()->SetSpeechSynthesisLibrary(NULL, false); |
| 398 if (mock_system_library_) | 406 if (mock_system_library_) |
| 399 test_api()->SetSystemLibrary(NULL, false); | 407 test_api()->SetSystemLibrary(NULL, false); |
| 400 if (mock_touchpad_library_) | 408 if (mock_touchpad_library_) |
| 401 test_api()->SetTouchpadLibrary(NULL, false); | 409 test_api()->SetTouchpadLibrary(NULL, false); |
| 402 } | 410 } |
| 403 | 411 |
| 404 } // namespace chromeos | 412 } // namespace chromeos |
| OLD | NEW |