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