| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 EXPECT_FALSE(auto_login_timer()->IsRunning()); | 661 EXPECT_FALSE(auto_login_timer()->IsRunning()); |
| 662 } | 662 } |
| 663 | 663 |
| 664 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, | 664 IN_PROC_BROWSER_TEST_F(ExistingUserControllerPublicSessionTest, |
| 665 CompleteLoginStopsAutoLogin) { | 665 CompleteLoginStopsAutoLogin) { |
| 666 // Set up mocks to check login success. | 666 // Set up mocks to check login success. |
| 667 UserContext user_context(gaia_account_id_); | 667 UserContext user_context(gaia_account_id_); |
| 668 user_context.SetKey(Key(kPassword)); | 668 user_context.SetKey(Key(kPassword)); |
| 669 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); | 669 user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail()); |
| 670 ExpectSuccessfulLogin(user_context); | 670 ExpectSuccessfulLogin(user_context); |
| 671 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()) | |
| 672 .Times(1); | |
| 673 | 671 |
| 674 existing_user_controller()->OnSigninScreenReady(); | 672 existing_user_controller()->OnSigninScreenReady(); |
| 675 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); | 673 SetAutoLoginPolicy(kPublicSessionUserEmail, kAutoLoginLongDelay); |
| 676 EXPECT_TRUE(auto_login_timer()); | 674 EXPECT_TRUE(auto_login_timer()); |
| 677 | 675 |
| 678 content::WindowedNotificationObserver profile_prepared_observer( | 676 content::WindowedNotificationObserver profile_prepared_observer( |
| 679 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 677 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 680 content::NotificationService::AllSources()); | 678 content::NotificationService::AllSources()); |
| 681 | 679 |
| 682 // Check that login completes and stops the timer. | 680 // Check that login completes and stops the timer. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); | 787 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); |
| 790 EXPECT_CALL(*mock_login_display_, | 788 EXPECT_CALL(*mock_login_display_, |
| 791 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, 1, | 789 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, 1, |
| 792 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT)) | 790 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT)) |
| 793 .Times(1); | 791 .Times(1); |
| 794 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); | 792 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); |
| 795 } | 793 } |
| 796 void ExpectLoginSuccess() { | 794 void ExpectLoginSuccess() { |
| 797 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); | 795 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); |
| 798 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); | 796 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); |
| 799 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()).Times(1); | |
| 800 } | 797 } |
| 801 }; | 798 }; |
| 802 | 799 |
| 803 // Tests that Active Directory online login succeeds on the Active Directory | 800 // Tests that Active Directory online login succeeds on the Active Directory |
| 804 // managed device. | 801 // managed device. |
| 805 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, | 802 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, |
| 806 ActiveDirectoryOnlineLogin_Success) { | 803 ActiveDirectoryOnlineLogin_Success) { |
| 807 ExpectLoginSuccess(); | 804 ExpectLoginSuccess(); |
| 808 UserContext user_context(ad_account_id_); | 805 UserContext user_context(ad_account_id_); |
| 809 user_context.SetKey(Key(kPassword)); | 806 user_context.SetKey(Key(kPassword)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 830 user_context.SetKey(Key(kPassword)); | 827 user_context.SetKey(Key(kPassword)); |
| 831 user_context.SetUserIDHash(ad_account_id_.GetUserEmail()); | 828 user_context.SetUserIDHash(ad_account_id_.GetUserEmail()); |
| 832 user_context.SetUserType(user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY); | 829 user_context.SetUserType(user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY); |
| 833 existing_user_controller()->Login(user_context, SigninSpecifics()); | 830 existing_user_controller()->Login(user_context, SigninSpecifics()); |
| 834 } | 831 } |
| 835 | 832 |
| 836 // Tests that Gaia login fails on the Active Directory managed device. | 833 // Tests that Gaia login fails on the Active Directory managed device. |
| 837 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, | 834 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, |
| 838 GAIAAccountLogin_Failure) { | 835 GAIAAccountLogin_Failure) { |
| 839 ExpectLoginFailure(); | 836 ExpectLoginFailure(); |
| 840 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()).Times(1); | |
| 841 UserContext user_context(gaia_account_id_); | 837 UserContext user_context(gaia_account_id_); |
| 842 user_context.SetKey(Key(kPassword)); | 838 user_context.SetKey(Key(kPassword)); |
| 843 user_context.SetUserIDHash(gaia_account_id_.GetUserEmail()); | 839 user_context.SetUserIDHash(gaia_account_id_.GetUserEmail()); |
| 844 existing_user_controller()->CompleteLogin(user_context); | 840 existing_user_controller()->CompleteLogin(user_context); |
| 845 } | 841 } |
| 846 | 842 |
| 847 } // namespace chromeos | 843 } // namespace chromeos |
| OLD | NEW |