| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 248 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
| 249 &base::Callback<void(void)>::Run)); | 249 &base::Callback<void(void)>::Run)); |
| 250 EXPECT_CALL(*mock_login_utils_, | 250 EXPECT_CALL(*mock_login_utils_, |
| 251 DoBrowserLaunch(testing_profile_.get(), | 251 DoBrowserLaunch(testing_profile_.get(), |
| 252 mock_login_display_host_.get())) | 252 mock_login_display_host_.get())) |
| 253 .Times(1); | 253 .Times(1); |
| 254 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kUsername)) | 254 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kUsername)) |
| 255 .Times(1); | 255 .Times(1); |
| 256 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 256 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
| 257 .Times(1); | 257 .Times(1); |
| 258 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
| 259 .Times(1); | |
| 260 EXPECT_CALL(*mock_login_display_host_, | 258 EXPECT_CALL(*mock_login_display_host_, |
| 261 StartWizardPtr(WizardController::kTermsOfServiceScreenName, NULL)) | 259 StartWizardPtr(WizardController::kTermsOfServiceScreenName, NULL)) |
| 262 .Times(0); | 260 .Times(0); |
| 263 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 261 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
| 264 .Times(AnyNumber()) | 262 .Times(AnyNumber()) |
| 265 .WillRepeatedly(Return(false)); | 263 .WillRepeatedly(Return(false)); |
| 266 existing_user_controller()->Login(UserContext(kUsername, kPassword, "")); | 264 existing_user_controller()->Login(UserContext(kUsername, kPassword, "")); |
| 267 content::RunAllPendingInMessageLoop(); | 265 content::RunAllPendingInMessageLoop(); |
| 268 } | 266 } |
| 269 | 267 |
| 270 IN_PROC_BROWSER_TEST_P(ExistingUserControllerTest, AutoEnrollAfterSignIn) { | 268 IN_PROC_BROWSER_TEST_P(ExistingUserControllerTest, AutoEnrollAfterSignIn) { |
| 271 EXPECT_CALL(*mock_login_display_host_, | 269 EXPECT_CALL(*mock_login_display_host_, |
| 272 StartWizardPtr(WizardController::kEnrollmentScreenName, | 270 StartWizardPtr(WizardController::kEnrollmentScreenName, |
| 273 _)) | 271 _)) |
| 274 .Times(1); | 272 .Times(1); |
| 275 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
| 276 .Times(1); | |
| 277 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) | 273 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) |
| 278 .Times(1); | 274 .Times(1); |
| 279 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 275 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
| 280 .Times(AnyNumber()) | 276 .Times(AnyNumber()) |
| 281 .WillRepeatedly(Return(false)); | 277 .WillRepeatedly(Return(false)); |
| 282 // The order of these expected calls matters: the UI if first disabled | 278 // The order of these expected calls matters: the UI if first disabled |
| 283 // during the login sequence, and is enabled again for the enrollment screen. | 279 // during the login sequence, and is enabled again for the enrollment screen. |
| 284 Sequence uiEnabledSequence; | 280 Sequence uiEnabledSequence; |
| 285 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 281 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
| 286 .Times(1) | 282 .Times(1) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 kNewUsername), | 314 kNewUsername), |
| 319 _, _, _, _)) | 315 _, _, _, _)) |
| 320 .Times(1) | 316 .Times(1) |
| 321 .WillOnce(DoAll( | 317 .WillOnce(DoAll( |
| 322 InvokeWithoutArgs(&add_user_cb, | 318 InvokeWithoutArgs(&add_user_cb, |
| 323 &base::Callback<void(void)>::Run), | 319 &base::Callback<void(void)>::Run), |
| 324 InvokeWithoutArgs(&profile_prepared_cb_, | 320 InvokeWithoutArgs(&profile_prepared_cb_, |
| 325 &base::Callback<void(void)>::Run))); | 321 &base::Callback<void(void)>::Run))); |
| 326 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kNewUsername)) | 322 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kNewUsername)) |
| 327 .Times(1); | 323 .Times(1); |
| 328 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
| 329 .Times(1); | |
| 330 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) | 324 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) |
| 331 .Times(1); | 325 .Times(1); |
| 332 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 326 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
| 333 .Times(AnyNumber()) | 327 .Times(AnyNumber()) |
| 334 .WillRepeatedly(Return(true)); | 328 .WillRepeatedly(Return(true)); |
| 335 | 329 |
| 336 // The order of these expected calls matters: the UI if first disabled | 330 // The order of these expected calls matters: the UI if first disabled |
| 337 // during the login sequence, and is enabled again after login completion. | 331 // during the login sequence, and is enabled again after login completion. |
| 338 Sequence uiEnabledSequence; | 332 Sequence uiEnabledSequence; |
| 339 // This is disabled twice: once right after signin but before checking for | 333 // This is disabled twice: once right after signin but before checking for |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 447 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
| 454 &base::Callback<void(void)>::Run)); | 448 &base::Callback<void(void)>::Run)); |
| 455 EXPECT_CALL(*mock_login_utils_, | 449 EXPECT_CALL(*mock_login_utils_, |
| 456 DoBrowserLaunch(testing_profile_.get(), | 450 DoBrowserLaunch(testing_profile_.get(), |
| 457 mock_login_display_host_.get())) | 451 mock_login_display_host_.get())) |
| 458 .Times(1); | 452 .Times(1); |
| 459 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(username)) | 453 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(username)) |
| 460 .Times(1); | 454 .Times(1); |
| 461 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 455 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
| 462 .Times(1); | 456 .Times(1); |
| 463 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
| 464 .Times(1); | |
| 465 EXPECT_CALL(*mock_login_display_host_, | 457 EXPECT_CALL(*mock_login_display_host_, |
| 466 StartWizardPtr(WizardController::kTermsOfServiceScreenName, | 458 StartWizardPtr(WizardController::kTermsOfServiceScreenName, |
| 467 NULL)) | 459 NULL)) |
| 468 .Times(0); | 460 .Times(0); |
| 469 } | 461 } |
| 470 | 462 |
| 471 void SetAutoLoginPolicy(const std::string& username, int delay) { | 463 void SetAutoLoginPolicy(const std::string& username, int delay) { |
| 472 // Wait until ExistingUserController has finished auto-login | 464 // Wait until ExistingUserController has finished auto-login |
| 473 // configuration by observing the same settings that trigger | 465 // configuration by observing the same settings that trigger |
| 474 // ConfigurePublicSessionAutoLogin. | 466 // ConfigurePublicSessionAutoLogin. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 682 |
| 691 INSTANTIATE_TEST_CASE_P(ExistingUserControllerTestInstantiation, | 683 INSTANTIATE_TEST_CASE_P(ExistingUserControllerTestInstantiation, |
| 692 ExistingUserControllerTest, | 684 ExistingUserControllerTest, |
| 693 testing::Bool()); | 685 testing::Bool()); |
| 694 | 686 |
| 695 INSTANTIATE_TEST_CASE_P(ExistingUserControllerPublicSessionTestInstantiation, | 687 INSTANTIATE_TEST_CASE_P(ExistingUserControllerPublicSessionTestInstantiation, |
| 696 ExistingUserControllerPublicSessionTest, | 688 ExistingUserControllerPublicSessionTest, |
| 697 testing::Bool()); | 689 testing::Bool()); |
| 698 | 690 |
| 699 } // namespace chromeos | 691 } // namespace chromeos |
| OLD | NEW |