| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_mock.h" | 10 #include "chrome/browser/chromeos/cros/cros_mock.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); | 243 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) { | 246 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) { |
| 247 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 247 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
| 248 .Times(1); | 248 .Times(1); |
| 249 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) | 249 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) |
| 250 .Times(1) | 250 .Times(1) |
| 251 .WillOnce(WithArg<0>(Invoke(CreateAuthenticator))); | 251 .WillOnce(WithArg<0>(Invoke(CreateAuthenticator))); |
| 252 EXPECT_CALL(*mock_login_utils_, | 252 EXPECT_CALL(*mock_login_utils_, |
| 253 PrepareProfile(kUsername, _, kPassword, false, _, _, _)) | 253 PrepareProfile(kUsername, _, kPassword, _, _, _)) |
| 254 .Times(1) | 254 .Times(1) |
| 255 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 255 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
| 256 &base::Callback<void(void)>::Run)); | 256 &base::Callback<void(void)>::Run)); |
| 257 EXPECT_CALL(*mock_login_utils_, | 257 EXPECT_CALL(*mock_login_utils_, |
| 258 DoBrowserLaunch(testing_profile_.get(), | 258 DoBrowserLaunch(testing_profile_.get(), |
| 259 mock_login_display_host_.get())) | 259 mock_login_display_host_.get())) |
| 260 .Times(1); | 260 .Times(1); |
| 261 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kUsername)) | 261 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kUsername)) |
| 262 .Times(1); | 262 .Times(1); |
| 263 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 263 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // activated. In a real WizardController instance that is immediately switched | 303 // activated. In a real WizardController instance that is immediately switched |
| 304 // to image screen but this tests uses MockLoginDisplayHost instead. | 304 // to image screen but this tests uses MockLoginDisplayHost instead. |
| 305 EXPECT_CALL(*mock_login_display_host_, | 305 EXPECT_CALL(*mock_login_display_host_, |
| 306 StartWizard(AnyOf(WizardController::kRegistrationScreenName, | 306 StartWizard(AnyOf(WizardController::kRegistrationScreenName, |
| 307 WizardController::kUserImageScreenName), _)) | 307 WizardController::kUserImageScreenName), _)) |
| 308 .Times(1); | 308 .Times(1); |
| 309 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) | 309 EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) |
| 310 .Times(1) | 310 .Times(1) |
| 311 .WillOnce(WithArg<0>(Invoke(CreateAuthenticatorNewUser))); | 311 .WillOnce(WithArg<0>(Invoke(CreateAuthenticatorNewUser))); |
| 312 EXPECT_CALL(*mock_login_utils_, | 312 EXPECT_CALL(*mock_login_utils_, |
| 313 PrepareProfile(kNewUsername, _, kPassword, false, _, _, _)) | 313 PrepareProfile(kNewUsername, _, kPassword, _, _, _)) |
| 314 .Times(1) | 314 .Times(1) |
| 315 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 315 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
| 316 &base::Callback<void(void)>::Run)); | 316 &base::Callback<void(void)>::Run)); |
| 317 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kNewUsername)) | 317 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kNewUsername)) |
| 318 .Times(1); | 318 .Times(1); |
| 319 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | 319 EXPECT_CALL(*mock_login_display_, OnFadeOut()) |
| 320 .Times(1); | 320 .Times(1); |
| 321 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) | 321 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) |
| 322 .Times(1); | 322 .Times(1); |
| 323 EXPECT_CALL(*mock_user_manager_.user_manager(), IsCurrentUserNew()) | 323 EXPECT_CALL(*mock_user_manager_.user_manager(), IsCurrentUserNew()) |
| 324 .Times(AnyNumber()) | 324 .Times(AnyNumber()) |
| 325 .WillRepeatedly(Return(true)); | 325 .WillRepeatedly(Return(true)); |
| 326 | 326 |
| 327 // The order of these expected calls matters: the UI if first disabled | 327 // The order of these expected calls matters: the UI if first disabled |
| 328 // during the login sequence, and is enabled again after login completion. | 328 // during the login sequence, and is enabled again after login completion. |
| 329 Sequence uiEnabledSequence; | 329 Sequence uiEnabledSequence; |
| 330 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 330 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
| 331 .Times(1) | 331 .Times(1) |
| 332 .InSequence(uiEnabledSequence); | 332 .InSequence(uiEnabledSequence); |
| 333 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 333 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
| 334 .Times(1) | 334 .Times(1) |
| 335 .InSequence(uiEnabledSequence); | 335 .InSequence(uiEnabledSequence); |
| 336 | 336 |
| 337 existing_user_controller()->CompleteLogin(kNewUsername, kPassword); | 337 existing_user_controller()->CompleteLogin(kNewUsername, kPassword); |
| 338 content::RunAllPendingInMessageLoop(); | 338 content::RunAllPendingInMessageLoop(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 } // namespace chromeos | 341 } // namespace chromeos |
| OLD | NEW |