| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 "LoggedInUsers"); | 191 "LoggedInUsers"); |
| 192 users_pref->AppendIfNotPresent(new base::StringValue(user_id)); | 192 users_pref->AppendIfNotPresent(new base::StringValue(user_id)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // ExistingUserController private member accessors. | 195 // ExistingUserController private member accessors. |
| 196 base::OneShotTimer* auto_login_timer() { | 196 base::OneShotTimer* auto_login_timer() { |
| 197 return existing_user_controller()->auto_login_timer_.get(); | 197 return existing_user_controller()->auto_login_timer_.get(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 AccountId auto_login_account_id() const { | 200 AccountId auto_login_account_id() const { |
| 201 return AccountId::FromUserEmail( | 201 return existing_user_controller()->public_session_auto_login_account_id_; |
| 202 existing_user_controller()->public_session_auto_login_username_); | |
| 203 } | 202 } |
| 204 | 203 |
| 205 int auto_login_delay() const { | 204 int auto_login_delay() const { |
| 206 return existing_user_controller()->public_session_auto_login_delay_; | 205 return existing_user_controller()->public_session_auto_login_delay_; |
| 207 } | 206 } |
| 208 | 207 |
| 209 bool is_login_in_progress() const { | 208 bool is_login_in_progress() const { |
| 210 return existing_user_controller()->is_login_in_progress_; | 209 return existing_user_controller()->is_login_in_progress_; |
| 211 } | 210 } |
| 212 | 211 |
| 213 scoped_ptr<ExistingUserController> existing_user_controller_; | 212 scoped_ptr<ExistingUserController> existing_user_controller_; |
| 214 | 213 |
| 215 // |mock_login_display_| is owned by the ExistingUserController, which calls | 214 // |mock_login_display_| is owned by the ExistingUserController, which calls |
| 216 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. | 215 // CreateLoginDisplay() on the |mock_login_display_host_| to get it. |
| 217 MockLoginDisplay* mock_login_display_ = nullptr; | 216 MockLoginDisplay* mock_login_display_ = nullptr; |
| 218 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; | 217 scoped_ptr<MockLoginDisplayHost> mock_login_display_host_; |
| 219 | 218 |
| 220 // Mock URLFetcher. | 219 // Mock URLFetcher. |
| 221 MockURLFetcherFactory<SuccessFetcher> factory_; | 220 MockURLFetcherFactory<SuccessFetcher> factory_; |
| 222 | 221 |
| 223 const AccountId account_id_ = AccountId::FromUserEmail(kUsername); | 222 const AccountId account_id_ = |
| 223 AccountId::FromUserEmailGaiaId(kUsername, kGaiaID); |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); | 226 DISALLOW_COPY_AND_ASSIGN(ExistingUserControllerTest); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, PRE_ExistingUserLogin) { | 229 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, PRE_ExistingUserLogin) { |
| 230 RegisterUser(account_id_.GetUserEmail()); | 230 RegisterUser(account_id_.GetUserEmail()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) { | 233 IN_PROC_BROWSER_TEST_F(ExistingUserControllerTest, ExistingUserLogin) { |
| 234 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 234 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
| 235 .Times(2); | 235 .Times(2); |
| 236 UserContext user_context(account_id_); | 236 UserContext user_context(account_id_); |
| 237 user_context.SetGaiaID(kGaiaID); | |
| 238 user_context.SetKey(Key(kPassword)); | 237 user_context.SetKey(Key(kPassword)); |
| 239 user_context.SetUserIDHash(account_id_.GetUserEmail()); | 238 user_context.SetUserIDHash(account_id_.GetUserEmail()); |
| 240 test::UserSessionManagerTestApi session_manager_test_api( | 239 test::UserSessionManagerTestApi session_manager_test_api( |
| 241 UserSessionManager::GetInstance()); | 240 UserSessionManager::GetInstance()); |
| 242 session_manager_test_api.InjectStubUserContext(user_context); | 241 session_manager_test_api.InjectStubUserContext(user_context); |
| 243 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) | 242 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)) |
| 244 .Times(1); | 243 .Times(1); |
| 245 EXPECT_CALL(*mock_login_display_host_, | 244 EXPECT_CALL(*mock_login_display_host_, |
| 246 StartWizard(WizardController::kTermsOfServiceScreenName)) | 245 StartWizard(WizardController::kTermsOfServiceScreenName)) |
| 247 .Times(0); | 246 .Times(0); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 278 ExpectLoginFailure(); | 277 ExpectLoginFailure(); |
| 279 } | 278 } |
| 280 | 279 |
| 281 void ExistingUserControllerUntrustedTest::SetUpSessionManager() { | 280 void ExistingUserControllerUntrustedTest::SetUpSessionManager() { |
| 282 InstallOwnerKey(); | 281 InstallOwnerKey(); |
| 283 } | 282 } |
| 284 | 283 |
| 285 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, | 284 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, |
| 286 ExistingUserLoginForbidden) { | 285 ExistingUserLoginForbidden) { |
| 287 UserContext user_context(account_id_); | 286 UserContext user_context(account_id_); |
| 288 user_context.SetGaiaID(kGaiaID); | |
| 289 user_context.SetKey(Key(kPassword)); | 287 user_context.SetKey(Key(kPassword)); |
| 290 user_context.SetUserIDHash(account_id_.GetUserEmail()); | 288 user_context.SetUserIDHash(account_id_.GetUserEmail()); |
| 291 existing_user_controller()->Login(user_context, SigninSpecifics()); | 289 existing_user_controller()->Login(user_context, SigninSpecifics()); |
| 292 } | 290 } |
| 293 | 291 |
| 294 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, | 292 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, |
| 295 NewUserLoginForbidden) { | 293 NewUserLoginForbidden) { |
| 296 UserContext user_context(account_id_); | 294 UserContext user_context(account_id_); |
| 297 user_context.SetGaiaID(kGaiaID); | |
| 298 user_context.SetKey(Key(kPassword)); | 295 user_context.SetKey(Key(kPassword)); |
| 299 user_context.SetUserIDHash(account_id_.GetUserEmail()); | 296 user_context.SetUserIDHash(account_id_.GetUserEmail()); |
| 300 existing_user_controller()->CompleteLogin(user_context); | 297 existing_user_controller()->CompleteLogin(user_context); |
| 301 } | 298 } |
| 302 | 299 |
| 303 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, | 300 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, |
| 304 GuestLoginForbidden) { | 301 GuestLoginForbidden) { |
| 305 existing_user_controller()->Login( | 302 existing_user_controller()->Login( |
| 306 UserContext(user_manager::USER_TYPE_GUEST, std::string()), | 303 UserContext(user_manager::USER_TYPE_GUEST, EmptyAccountId()), |
| 307 SigninSpecifics()); | 304 SigninSpecifics()); |
| 308 } | 305 } |
| 309 | 306 |
| 310 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, | 307 IN_PROC_BROWSER_TEST_F(ExistingUserControllerUntrustedTest, |
| 311 SupervisedUserLoginForbidden) { | 308 SupervisedUserLoginForbidden) { |
| 312 UserContext user_context(AccountId::FromUserEmail(kSupervisedUserID)); | 309 UserContext user_context(AccountId::FromUserEmail(kSupervisedUserID)); |
| 313 user_context.SetKey(Key(kPassword)); | 310 user_context.SetKey(Key(kPassword)); |
| 314 user_context.SetUserIDHash(account_id_.GetUserEmail()); | 311 user_context.SetUserIDHash(account_id_.GetUserEmail()); |
| 315 existing_user_controller()->Login(user_context, SigninSpecifics()); | 312 existing_user_controller()->Login(user_context, SigninSpecifics()); |
| 316 } | 313 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 EXPECT_TRUE(!auto_login_account_id().is_valid()); | 516 EXPECT_TRUE(!auto_login_account_id().is_valid()); |
| 520 EXPECT_EQ(0, auto_login_delay()); | 517 EXPECT_EQ(0, auto_login_delay()); |
| 521 ASSERT_TRUE(auto_login_timer()); | 518 ASSERT_TRUE(auto_login_timer()); |
| 522 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 519 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 523 } | 520 } |
| 524 | 521 |
| 525 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 522 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 526 AutoLoginNoDelay) { | 523 AutoLoginNoDelay) { |
| 527 // Set up mocks to check login success. | 524 // Set up mocks to check login success. |
| 528 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, | 525 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, |
| 529 public_session_account_id_.GetUserEmail()); | 526 public_session_account_id_); |
| 530 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 527 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 531 ExpectSuccessfulLogin(user_context); | 528 ExpectSuccessfulLogin(user_context); |
| 532 existing_user_controller()->OnSigninScreenReady(); | 529 existing_user_controller()->OnSigninScreenReady(); |
| 533 | 530 |
| 534 // Start auto-login and wait for login tasks to complete. | 531 // Start auto-login and wait for login tasks to complete. |
| 535 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginNoDelay); | 532 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginNoDelay); |
| 536 content::RunAllPendingInMessageLoop(); | 533 content::RunAllPendingInMessageLoop(); |
| 537 } | 534 } |
| 538 | 535 |
| 539 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 536 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 540 AutoLoginShortDelay) { | 537 AutoLoginShortDelay) { |
| 541 // Set up mocks to check login success. | 538 // Set up mocks to check login success. |
| 542 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, | 539 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, |
| 543 public_session_account_id_.GetUserEmail()); | 540 public_session_account_id_); |
| 544 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 541 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 545 ExpectSuccessfulLogin(user_context); | 542 ExpectSuccessfulLogin(user_context); |
| 546 existing_user_controller()->OnSigninScreenReady(); | 543 existing_user_controller()->OnSigninScreenReady(); |
| 547 | 544 |
| 548 content::WindowedNotificationObserver profile_prepared_observer( | 545 content::WindowedNotificationObserver profile_prepared_observer( |
| 549 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 546 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 550 content::NotificationService::AllSources()); | 547 content::NotificationService::AllSources()); |
| 551 | 548 |
| 552 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginShortDelay); | 549 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginShortDelay); |
| 553 ASSERT_TRUE(auto_login_timer()); | 550 ASSERT_TRUE(auto_login_timer()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 566 profile_prepared_observer.Wait(); | 563 profile_prepared_observer.Wait(); |
| 567 | 564 |
| 568 // Wait for login tasks to complete. | 565 // Wait for login tasks to complete. |
| 569 content::RunAllPendingInMessageLoop(); | 566 content::RunAllPendingInMessageLoop(); |
| 570 } | 567 } |
| 571 | 568 |
| 572 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 569 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 573 LoginStopsAutoLogin) { | 570 LoginStopsAutoLogin) { |
| 574 // Set up mocks to check login success. | 571 // Set up mocks to check login success. |
| 575 UserContext user_context(account_id_); | 572 UserContext user_context(account_id_); |
| 576 user_context.SetGaiaID(kGaiaID); | |
| 577 user_context.SetKey(Key(kPassword)); | 573 user_context.SetKey(Key(kPassword)); |
| 578 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 574 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 579 ExpectSuccessfulLogin(user_context); | 575 ExpectSuccessfulLogin(user_context); |
| 580 | 576 |
| 581 existing_user_controller()->OnSigninScreenReady(); | 577 existing_user_controller()->OnSigninScreenReady(); |
| 582 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 578 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 583 EXPECT_TRUE(auto_login_timer()); | 579 EXPECT_TRUE(auto_login_timer()); |
| 584 | 580 |
| 585 content::WindowedNotificationObserver profile_prepared_observer( | 581 content::WindowedNotificationObserver profile_prepared_observer( |
| 586 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 582 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 600 // Timer should still be stopped after login completes. | 596 // Timer should still be stopped after login completes. |
| 601 ASSERT_TRUE(auto_login_timer()); | 597 ASSERT_TRUE(auto_login_timer()); |
| 602 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 598 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 603 } | 599 } |
| 604 | 600 |
| 605 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 601 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 606 GuestModeLoginStopsAutoLogin) { | 602 GuestModeLoginStopsAutoLogin) { |
| 607 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) | 603 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)) |
| 608 .Times(2); | 604 .Times(2); |
| 609 UserContext user_context(account_id_); | 605 UserContext user_context(account_id_); |
| 610 user_context.SetGaiaID(kGaiaID); | |
| 611 user_context.SetKey(Key(kPassword)); | 606 user_context.SetKey(Key(kPassword)); |
| 612 test::UserSessionManagerTestApi session_manager_test_api( | 607 test::UserSessionManagerTestApi session_manager_test_api( |
| 613 UserSessionManager::GetInstance()); | 608 UserSessionManager::GetInstance()); |
| 614 session_manager_test_api.InjectStubUserContext(user_context); | 609 session_manager_test_api.InjectStubUserContext(user_context); |
| 615 | 610 |
| 616 existing_user_controller()->OnSigninScreenReady(); | 611 existing_user_controller()->OnSigninScreenReady(); |
| 617 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 612 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 618 EXPECT_TRUE(auto_login_timer()); | 613 EXPECT_TRUE(auto_login_timer()); |
| 619 | 614 |
| 620 // Login and check that it stopped the timer. | 615 // Login and check that it stopped the timer. |
| 621 existing_user_controller()->Login(UserContext(user_manager::USER_TYPE_GUEST, | 616 existing_user_controller()->Login( |
| 622 std::string()), | 617 UserContext(user_manager::USER_TYPE_GUEST, EmptyAccountId()), |
| 623 SigninSpecifics()); | 618 SigninSpecifics()); |
| 624 EXPECT_TRUE(is_login_in_progress()); | 619 EXPECT_TRUE(is_login_in_progress()); |
| 625 ASSERT_TRUE(auto_login_timer()); | 620 ASSERT_TRUE(auto_login_timer()); |
| 626 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 621 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 627 | 622 |
| 628 // Wait for login tasks to complete. | 623 // Wait for login tasks to complete. |
| 629 content::RunAllPendingInMessageLoop(); | 624 content::RunAllPendingInMessageLoop(); |
| 630 | 625 |
| 631 // Timer should still be stopped after login completes. | 626 // Timer should still be stopped after login completes. |
| 632 ASSERT_TRUE(auto_login_timer()); | 627 ASSERT_TRUE(auto_login_timer()); |
| 633 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 628 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 634 } | 629 } |
| 635 | 630 |
| 636 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 631 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 637 CompleteLoginStopsAutoLogin) { | 632 CompleteLoginStopsAutoLogin) { |
| 638 // Set up mocks to check login success. | 633 // Set up mocks to check login success. |
| 639 UserContext user_context(account_id_); | 634 UserContext user_context(account_id_); |
| 640 user_context.SetGaiaID(kGaiaID); | |
| 641 user_context.SetKey(Key(kPassword)); | 635 user_context.SetKey(Key(kPassword)); |
| 642 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 636 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 643 ExpectSuccessfulLogin(user_context); | 637 ExpectSuccessfulLogin(user_context); |
| 644 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()) | 638 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()) |
| 645 .Times(1); | 639 .Times(1); |
| 646 | 640 |
| 647 existing_user_controller()->OnSigninScreenReady(); | 641 existing_user_controller()->OnSigninScreenReady(); |
| 648 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 642 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 649 EXPECT_TRUE(auto_login_timer()); | 643 EXPECT_TRUE(auto_login_timer()); |
| 650 | 644 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 664 | 658 |
| 665 // Timer should still be stopped after login completes. | 659 // Timer should still be stopped after login completes. |
| 666 ASSERT_TRUE(auto_login_timer()); | 660 ASSERT_TRUE(auto_login_timer()); |
| 667 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 661 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 668 } | 662 } |
| 669 | 663 |
| 670 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 664 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 671 PublicSessionLoginStopsAutoLogin) { | 665 PublicSessionLoginStopsAutoLogin) { |
| 672 // Set up mocks to check login success. | 666 // Set up mocks to check login success. |
| 673 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, | 667 UserContext user_context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, |
| 674 public_session_account_id_.GetUserEmail()); | 668 public_session_account_id_); |
| 675 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 669 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 676 ExpectSuccessfulLogin(user_context); | 670 ExpectSuccessfulLogin(user_context); |
| 677 existing_user_controller()->OnSigninScreenReady(); | 671 existing_user_controller()->OnSigninScreenReady(); |
| 678 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 672 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 679 EXPECT_TRUE(auto_login_timer()); | 673 EXPECT_TRUE(auto_login_timer()); |
| 680 | 674 |
| 681 content::WindowedNotificationObserver profile_prepared_observer( | 675 content::WindowedNotificationObserver profile_prepared_observer( |
| 682 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 676 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 683 content::NotificationService::AllSources()); | 677 content::NotificationService::AllSources()); |
| 684 | 678 |
| 685 // Login and check that it stopped the timer. | 679 // Login and check that it stopped the timer. |
| 686 existing_user_controller()->Login( | 680 existing_user_controller()->Login( |
| 687 UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT, | 681 UserContext(user_manager::USER_TYPE_PUBLIC_ACCOUNT, |
| 688 public_session_account_id_.GetUserEmail()), | 682 public_session_account_id_), |
| 689 SigninSpecifics()); | 683 SigninSpecifics()); |
| 690 | 684 |
| 691 EXPECT_TRUE(is_login_in_progress()); | 685 EXPECT_TRUE(is_login_in_progress()); |
| 692 ASSERT_TRUE(auto_login_timer()); | 686 ASSERT_TRUE(auto_login_timer()); |
| 693 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 687 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 694 | 688 |
| 695 profile_prepared_observer.Wait(); | 689 profile_prepared_observer.Wait(); |
| 696 | 690 |
| 697 // Wait for login tasks to complete. | 691 // Wait for login tasks to complete. |
| 698 content::RunAllPendingInMessageLoop(); | 692 content::RunAllPendingInMessageLoop(); |
| 699 | 693 |
| 700 // Timer should still be stopped after login completes. | 694 // Timer should still be stopped after login completes. |
| 701 ASSERT_TRUE(auto_login_timer()); | 695 ASSERT_TRUE(auto_login_timer()); |
| 702 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 696 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 703 } | 697 } |
| 704 | 698 |
| 705 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 699 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 706 LoginForbiddenWhenUntrusted) { | 700 LoginForbiddenWhenUntrusted) { |
| 707 // Make cros settings untrusted. | 701 // Make cros settings untrusted. |
| 708 MakeCrosSettingsPermanentlyUntrusted(); | 702 MakeCrosSettingsPermanentlyUntrusted(); |
| 709 | 703 |
| 710 // Check that the attempt to start a public session fails with an error. | 704 // Check that the attempt to start a public session fails with an error. |
| 711 ExpectLoginFailure(); | 705 ExpectLoginFailure(); |
| 712 UserContext user_context(account_id_); | 706 UserContext user_context(account_id_); |
| 713 user_context.SetGaiaID(kGaiaID); | |
| 714 user_context.SetKey(Key(kPassword)); | 707 user_context.SetKey(Key(kPassword)); |
| 715 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 708 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 716 existing_user_controller()->Login(user_context, SigninSpecifics()); | 709 existing_user_controller()->Login(user_context, SigninSpecifics()); |
| 717 } | 710 } |
| 718 | 711 |
| 719 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 712 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 720 NoAutoLoginWhenUntrusted) { | 713 NoAutoLoginWhenUntrusted) { |
| 721 // Start the public session timer. | 714 // Start the public session timer. |
| 722 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 715 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 723 existing_user_controller()->OnSigninScreenReady(); | 716 existing_user_controller()->OnSigninScreenReady(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 735 PRE_TestLoadingPublicUsersFromLocalState) { | 728 PRE_TestLoadingPublicUsersFromLocalState) { |
| 736 // First run propagates public accounts and stores them in Local State. | 729 // First run propagates public accounts and stores them in Local State. |
| 737 } | 730 } |
| 738 | 731 |
| 739 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 732 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 740 TestLoadingPublicUsersFromLocalState) { | 733 TestLoadingPublicUsersFromLocalState) { |
| 741 // Second run loads list of public accounts from Local State. | 734 // Second run loads list of public accounts from Local State. |
| 742 } | 735 } |
| 743 | 736 |
| 744 } // namespace chromeos | 737 } // namespace chromeos |
| OLD | NEW |