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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 user_context.SetPassword(kPassword); | 243 user_context.SetPassword(kPassword); |
244 user_context.SetUserIDHash(kUsername); | 244 user_context.SetUserIDHash(kUsername); |
245 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) | 245 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) |
246 .Times(1) | 246 .Times(1) |
247 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 247 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
248 &base::Callback<void(void)>::Run)); | 248 &base::Callback<void(void)>::Run)); |
249 EXPECT_CALL(*mock_login_utils_, | 249 EXPECT_CALL(*mock_login_utils_, |
250 DoBrowserLaunch(testing_profile_.get(), | 250 DoBrowserLaunch(testing_profile_.get(), |
251 mock_login_display_host_.get())) | 251 mock_login_display_host_.get())) |
252 .Times(1); | 252 .Times(1); |
253 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kUsername)) | |
254 .Times(1); | |
255 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 253 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
256 .Times(1); | 254 .Times(1); |
257 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
258 .Times(1); | |
259 EXPECT_CALL(*mock_login_display_host_, | 255 EXPECT_CALL(*mock_login_display_host_, |
260 StartWizardPtr(WizardController::kTermsOfServiceScreenName, NULL)) | 256 StartWizardPtr(WizardController::kTermsOfServiceScreenName, NULL)) |
261 .Times(0); | 257 .Times(0); |
262 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 258 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
263 .Times(AnyNumber()) | 259 .Times(AnyNumber()) |
264 .WillRepeatedly(Return(false)); | 260 .WillRepeatedly(Return(false)); |
265 existing_user_controller()->Login(user_context); | 261 existing_user_controller()->Login(user_context); |
266 content::RunAllPendingInMessageLoop(); | 262 content::RunAllPendingInMessageLoop(); |
267 } | 263 } |
268 | 264 |
269 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, AutoEnrollAfterSignIn) { | 265 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, AutoEnrollAfterSignIn) { |
270 EXPECT_CALL(*mock_login_display_host_, | 266 EXPECT_CALL(*mock_login_display_host_, |
271 StartWizardPtr(WizardController::kEnrollmentScreenName, | 267 StartWizardPtr(WizardController::kEnrollmentScreenName, |
272 _)) | 268 _)) |
273 .Times(1); | 269 .Times(1); |
274 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
275 .Times(1); | |
276 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) | 270 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) |
277 .Times(1); | 271 .Times(1); |
278 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 272 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
279 .Times(AnyNumber()) | 273 .Times(AnyNumber()) |
280 .WillRepeatedly(Return(false)); | 274 .WillRepeatedly(Return(false)); |
281 // The order of these expected calls matters: the UI if first disabled | 275 // The order of these expected calls matters: the UI if first disabled |
282 // during the login sequence, and is enabled again for the enrollment screen. | 276 // during the login sequence, and is enabled again for the enrollment screen. |
283 Sequence uiEnabledSequence; | 277 Sequence uiEnabledSequence; |
284 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 278 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
285 .Times(1) | 279 .Times(1) |
(...skipping 28 matching lines...) Expand all Loading... |
314 UserContext user_context(kNewUsername); | 308 UserContext user_context(kNewUsername); |
315 user_context.SetPassword(kPassword); | 309 user_context.SetPassword(kPassword); |
316 user_context.SetUserIDHash(kNewUsername); | 310 user_context.SetUserIDHash(kNewUsername); |
317 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) | 311 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) |
318 .Times(1) | 312 .Times(1) |
319 .WillOnce(DoAll( | 313 .WillOnce(DoAll( |
320 InvokeWithoutArgs(&add_user_cb, | 314 InvokeWithoutArgs(&add_user_cb, |
321 &base::Callback<void(void)>::Run), | 315 &base::Callback<void(void)>::Run), |
322 InvokeWithoutArgs(&profile_prepared_cb_, | 316 InvokeWithoutArgs(&profile_prepared_cb_, |
323 &base::Callback<void(void)>::Run))); | 317 &base::Callback<void(void)>::Run))); |
324 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(kNewUsername)) | |
325 .Times(1); | |
326 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
327 .Times(1); | |
328 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) | 318 EXPECT_CALL(*mock_login_display_host_.get(), OnCompleteLogin()) |
329 .Times(1); | 319 .Times(1); |
330 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) | 320 EXPECT_CALL(*mock_user_manager_, IsCurrentUserNew()) |
331 .Times(AnyNumber()) | 321 .Times(AnyNumber()) |
332 .WillRepeatedly(Return(true)); | 322 .WillRepeatedly(Return(true)); |
333 | 323 |
334 // The order of these expected calls matters: the UI if first disabled | 324 // The order of these expected calls matters: the UI if first disabled |
335 // during the login sequence, and is enabled again after login completion. | 325 // during the login sequence, and is enabled again after login completion. |
336 Sequence uiEnabledSequence; | 326 Sequence uiEnabledSequence; |
337 // This is disabled twice: once right after signin but before checking for | 327 // This is disabled twice: once right after signin but before checking for |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 user_context.SetPassword(password); | 437 user_context.SetPassword(password); |
448 user_context.SetUserIDHash(username); | 438 user_context.SetUserIDHash(username); |
449 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) | 439 EXPECT_CALL(*mock_login_utils_, PrepareProfile(user_context, _, _, _, _)) |
450 .Times(1) | 440 .Times(1) |
451 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, | 441 .WillOnce(InvokeWithoutArgs(&profile_prepared_cb_, |
452 &base::Callback<void(void)>::Run)); | 442 &base::Callback<void(void)>::Run)); |
453 EXPECT_CALL(*mock_login_utils_, | 443 EXPECT_CALL(*mock_login_utils_, |
454 DoBrowserLaunch(testing_profile_.get(), | 444 DoBrowserLaunch(testing_profile_.get(), |
455 mock_login_display_host_.get())) | 445 mock_login_display_host_.get())) |
456 .Times(1); | 446 .Times(1); |
457 EXPECT_CALL(*mock_login_display_, OnLoginSuccess(username)) | |
458 .Times(1); | |
459 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 447 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
460 .Times(1); | 448 .Times(1); |
461 EXPECT_CALL(*mock_login_display_, OnFadeOut()) | |
462 .Times(1); | |
463 EXPECT_CALL(*mock_login_display_host_, | 449 EXPECT_CALL(*mock_login_display_host_, |
464 StartWizardPtr(WizardController::kTermsOfServiceScreenName, | 450 StartWizardPtr(WizardController::kTermsOfServiceScreenName, |
465 NULL)) | 451 NULL)) |
466 .Times(0); | 452 .Times(0); |
467 } | 453 } |
468 | 454 |
469 void SetAutoLoginPolicy(const std::string& username, int delay) { | 455 void SetAutoLoginPolicy(const std::string& username, int delay) { |
470 // Wait until ExistingUserController has finished auto-login | 456 // Wait until ExistingUserController has finished auto-login |
471 // configuration by observing the same settings that trigger | 457 // configuration by observing the same settings that trigger |
472 // ConfigurePublicSessionAutoLogin. | 458 // ConfigurePublicSessionAutoLogin. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 PRE_TestLoadingPublicUsersFromLocalState) { | 669 PRE_TestLoadingPublicUsersFromLocalState) { |
684 // First run propagates public accounts and stores them in Local State. | 670 // First run propagates public accounts and stores them in Local State. |
685 } | 671 } |
686 | 672 |
687 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 673 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
688 TestLoadingPublicUsersFromLocalState) { | 674 TestLoadingPublicUsersFromLocalState) { |
689 // Second run loads list of public accounts from Local State. | 675 // Second run loads list of public accounts from Local State. |
690 } | 676 } |
691 | 677 |
692 } // namespace chromeos | 678 } // namespace chromeos |
OLD | NEW |