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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/chromeos/login/wizard_controller.h" | 22 #include "chrome/browser/chromeos/login/wizard_controller.h" |
23 #include "chrome/browser/chromeos/login/wizard_screen.h" | 23 #include "chrome/browser/chromeos/login/wizard_screen.h" |
24 #include "chrome/test/in_process_browser_test.h" | 24 #include "chrome/test/in_process_browser_test.h" |
25 #include "chrome/test/ui_test_utils.h" | 25 #include "chrome/test/ui_test_utils.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 | 28 |
29 namespace chromeos { | 29 namespace chromeos { |
30 | 30 |
31 using ::testing::AnyNumber; | 31 using ::testing::AnyNumber; |
| 32 using ::testing::AtMost; |
32 using ::testing::InSequence; | 33 using ::testing::InSequence; |
33 using ::testing::InvokeWithoutArgs; | 34 using ::testing::InvokeWithoutArgs; |
34 using ::testing::Return; | 35 using ::testing::Return; |
35 using ::testing::ReturnRef; | 36 using ::testing::ReturnRef; |
36 using ::testing::StrictMock; | 37 using ::testing::StrictMock; |
37 using ::testing::_; | 38 using ::testing::_; |
38 | 39 |
39 CrosMock::CrosMock() | 40 CrosMock::CrosMock() |
40 : loader_(NULL), | 41 : loader_(NULL), |
41 mock_cryptohome_library_(NULL), | 42 mock_cryptohome_library_(NULL), |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 .RetiresOnSaturation(); | 263 .RetiresOnSaturation(); |
263 EXPECT_CALL(*mock_input_method_library_, SetDeferImeStartup(_)) | 264 EXPECT_CALL(*mock_input_method_library_, SetDeferImeStartup(_)) |
264 .Times(AnyNumber()) | 265 .Times(AnyNumber()) |
265 .RetiresOnSaturation(); | 266 .RetiresOnSaturation(); |
266 EXPECT_CALL(*mock_input_method_library_, StopInputMethodProcesses()) | 267 EXPECT_CALL(*mock_input_method_library_, StopInputMethodProcesses()) |
267 .Times(AnyNumber()) | 268 .Times(AnyNumber()) |
268 .RetiresOnSaturation(); | 269 .RetiresOnSaturation(); |
269 } | 270 } |
270 | 271 |
271 void CrosMock::SetNetworkLibraryStatusAreaExpectations() { | 272 void CrosMock::SetNetworkLibraryStatusAreaExpectations() { |
272 EXPECT_CALL(*mock_network_library_, AddObserver(_)) | 273 EXPECT_CALL(*mock_network_library_, AddNetworkManagerObserver(_)) |
| 274 .Times(1) |
| 275 .RetiresOnSaturation(); |
| 276 EXPECT_CALL(*mock_network_library_, AddCellularDataPlanObserver(_)) |
273 .Times(1) | 277 .Times(1) |
274 .RetiresOnSaturation(); | 278 .RetiresOnSaturation(); |
275 | 279 |
276 // NetworkDropdownButton::NetworkChanged() calls: | 280 // NetworkMenuButton::OnNetworkManagerChanged() calls: |
277 EXPECT_CALL(*mock_network_library_, ethernet_connected()) | 281 EXPECT_CALL(*mock_network_library_, active_network()) |
278 .Times(1) | 282 .Times(1) |
279 .WillRepeatedly((Return(false))) | 283 .WillRepeatedly((Return((const Network*)(NULL)))) |
280 .RetiresOnSaturation(); | |
281 EXPECT_CALL(*mock_network_library_, wifi_connected()) | |
282 .Times(1) | |
283 .WillRepeatedly((Return(false))) | |
284 .RetiresOnSaturation(); | 284 .RetiresOnSaturation(); |
285 EXPECT_CALL(*mock_network_library_, wifi_connecting()) | 285 EXPECT_CALL(*mock_network_library_, wifi_connecting()) |
286 .Times(1) | 286 .Times(1) |
287 .WillRepeatedly((Return(false))) | 287 .WillRepeatedly((Return(false))) |
288 .RetiresOnSaturation(); | 288 .RetiresOnSaturation(); |
289 EXPECT_CALL(*mock_network_library_, cellular_connected()) | |
290 .Times(1) | |
291 .WillRepeatedly((Return(false))) | |
292 .RetiresOnSaturation(); | |
293 EXPECT_CALL(*mock_network_library_, cellular_connecting()) | 289 EXPECT_CALL(*mock_network_library_, cellular_connecting()) |
294 .Times(1) | 290 .Times(1) |
295 .WillRepeatedly((Return(false))) | 291 .WillRepeatedly((Return(false))) |
296 .RetiresOnSaturation(); | 292 .RetiresOnSaturation(); |
297 EXPECT_CALL(*mock_network_library_, Connected()) | 293 EXPECT_CALL(*mock_network_library_, Connected()) |
298 .Times(1) | 294 .Times(2) |
299 .WillRepeatedly((Return(false))) | 295 .WillRepeatedly((Return(false))) |
300 .RetiresOnSaturation(); | 296 .RetiresOnSaturation(); |
301 EXPECT_CALL(*mock_network_library_, Connecting()) | 297 EXPECT_CALL(*mock_network_library_, Connecting()) |
302 .Times(1) | 298 .Times(1) |
303 .WillRepeatedly((Return(false))) | 299 .WillRepeatedly((Return(false))) |
304 .RetiresOnSaturation(); | 300 .RetiresOnSaturation(); |
305 | 301 |
306 // NetworkMenu::InitMenuItems() calls: | 302 // NetworkMenu::InitMenuItems() calls: |
307 EXPECT_CALL(*mock_network_library_, ethernet_available()) | 303 EXPECT_CALL(*mock_network_library_, ethernet_available()) |
308 .Times(1) | 304 .Times(1) |
309 .WillRepeatedly((Return(true))) | 305 .WillRepeatedly((Return(true))) |
310 .RetiresOnSaturation(); | 306 .RetiresOnSaturation(); |
311 EXPECT_CALL(*mock_network_library_, ethernet_connected()) | 307 EXPECT_CALL(*mock_network_library_, ethernet_connected()) |
312 .Times(1) | 308 .Times(1) |
313 .WillRepeatedly((Return(false))) | 309 .WillRepeatedly((Return(false))) |
314 .RetiresOnSaturation(); | 310 .RetiresOnSaturation(); |
315 EXPECT_CALL(*mock_network_library_, ethernet_connecting()) | 311 EXPECT_CALL(*mock_network_library_, ethernet_connecting()) |
316 .Times(1) | 312 .Times(1) |
317 .WillRepeatedly((Return(false))) | 313 .WillRepeatedly((Return(false))) |
318 .RetiresOnSaturation(); | 314 .RetiresOnSaturation(); |
319 EXPECT_CALL(*mock_network_library_, wifi_available()) | 315 EXPECT_CALL(*mock_network_library_, wifi_available()) |
320 .Times(1) | 316 .Times(1) |
321 .WillRepeatedly((Return(false))) | 317 .WillRepeatedly((Return(false))) |
322 .RetiresOnSaturation(); | 318 .RetiresOnSaturation(); |
323 EXPECT_CALL(*mock_network_library_, cellular_available()) | 319 EXPECT_CALL(*mock_network_library_, cellular_available()) |
324 .Times(1) | 320 .Times(1) |
325 .WillRepeatedly((Return(false))) | 321 .WillRepeatedly((Return(false))) |
326 .RetiresOnSaturation(); | 322 .RetiresOnSaturation(); |
327 | 323 |
328 EXPECT_CALL(*mock_network_library_, RemoveObserver(_)) | 324 EXPECT_CALL(*mock_network_library_, RemoveNetworkManagerObserver(_)) |
| 325 .Times(1) |
| 326 .RetiresOnSaturation(); |
| 327 EXPECT_CALL(*mock_network_library_, RemoveObserverForAllNetworks(_)) |
| 328 .Times(1) |
| 329 .RetiresOnSaturation(); |
| 330 EXPECT_CALL(*mock_network_library_, RemoveCellularDataPlanObserver(_)) |
329 .Times(1) | 331 .Times(1) |
330 .RetiresOnSaturation(); | 332 .RetiresOnSaturation(); |
331 } | 333 } |
332 | 334 |
333 void CrosMock::SetPowerLibraryStatusAreaExpectations() { | 335 void CrosMock::SetPowerLibraryStatusAreaExpectations() { |
334 EXPECT_CALL(*mock_power_library_, AddObserver(_)) | 336 EXPECT_CALL(*mock_power_library_, AddObserver(_)) |
335 .Times(1) | 337 .Times(1) |
336 .RetiresOnSaturation(); | 338 .RetiresOnSaturation(); |
337 EXPECT_CALL(*mock_power_library_, battery_fully_charged()) | 339 EXPECT_CALL(*mock_power_library_, battery_fully_charged()) |
338 .Times(1) | 340 .Times(1) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 test_api()->SetScreenLockLibrary(NULL, false); | 434 test_api()->SetScreenLockLibrary(NULL, false); |
433 if (mock_speech_synthesis_library_) | 435 if (mock_speech_synthesis_library_) |
434 test_api()->SetSpeechSynthesisLibrary(NULL, false); | 436 test_api()->SetSpeechSynthesisLibrary(NULL, false); |
435 if (mock_system_library_) | 437 if (mock_system_library_) |
436 test_api()->SetSystemLibrary(NULL, false); | 438 test_api()->SetSystemLibrary(NULL, false); |
437 if (mock_touchpad_library_) | 439 if (mock_touchpad_library_) |
438 test_api()->SetTouchpadLibrary(NULL, false); | 440 test_api()->SetTouchpadLibrary(NULL, false); |
439 } | 441 } |
440 | 442 |
441 } // namespace chromeos | 443 } // namespace chromeos |
OLD | NEW |