| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); | 792 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); |
| 795 EXPECT_CALL(*mock_login_display_, | 793 EXPECT_CALL(*mock_login_display_, |
| 796 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, 1, | 794 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, 1, |
| 797 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT)) | 795 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT)) |
| 798 .Times(1); | 796 .Times(1); |
| 799 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); | 797 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); |
| 800 } | 798 } |
| 801 void ExpectLoginSuccess() { | 799 void ExpectLoginSuccess() { |
| 802 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); | 800 EXPECT_CALL(*mock_login_display_, SetUIEnabled(false)).Times(2); |
| 803 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); | 801 EXPECT_CALL(*mock_login_display_, SetUIEnabled(true)).Times(1); |
| 804 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()).Times(1); | |
| 805 } | 802 } |
| 806 }; | 803 }; |
| 807 | 804 |
| 808 // Tests that Active Directory online login succeeds on the Active Directory | 805 // Tests that Active Directory online login succeeds on the Active Directory |
| 809 // managed device. | 806 // managed device. |
| 810 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, | 807 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, |
| 811 ActiveDirectoryOnlineLogin_Success) { | 808 ActiveDirectoryOnlineLogin_Success) { |
| 812 ExpectLoginSuccess(); | 809 ExpectLoginSuccess(); |
| 813 UserContext user_context(ad_account_id_); | 810 UserContext user_context(ad_account_id_); |
| 814 user_context.SetKey(Key(kPassword)); | 811 user_context.SetKey(Key(kPassword)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 835 user_context.SetKey(Key(kPassword)); | 832 user_context.SetKey(Key(kPassword)); |
| 836 user_context.SetUserIDHash(ad_account_id_.GetUserEmail()); | 833 user_context.SetUserIDHash(ad_account_id_.GetUserEmail()); |
| 837 user_context.SetUserType(user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY); | 834 user_context.SetUserType(user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY); |
| 838 existing_user_controller()->Login(user_context, SigninSpecifics()); | 835 existing_user_controller()->Login(user_context, SigninSpecifics()); |
| 839 } | 836 } |
| 840 | 837 |
| 841 // Tests that Gaia login fails on the Active Directory managed device. | 838 // Tests that Gaia login fails on the Active Directory managed device. |
| 842 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, | 839 IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, |
| 843 GAIAAccountLogin_Failure) { | 840 GAIAAccountLogin_Failure) { |
| 844 ExpectLoginFailure(); | 841 ExpectLoginFailure(); |
| 845 EXPECT_CALL(*mock_login_display_host_, OnCompleteLogin()).Times(1); | |
| 846 UserContext user_context(gaia_account_id_); | 842 UserContext user_context(gaia_account_id_); |
| 847 user_context.SetKey(Key(kPassword)); | 843 user_context.SetKey(Key(kPassword)); |
| 848 user_context.SetUserIDHash(gaia_account_id_.GetUserEmail()); | 844 user_context.SetUserIDHash(gaia_account_id_.GetUserEmail()); |
| 849 existing_user_controller()->CompleteLogin(user_context); | 845 existing_user_controller()->CompleteLogin(user_context); |
| 850 } | 846 } |
| 851 | 847 |
| 852 } // namespace chromeos | 848 } // namespace chromeos |
| OLD | NEW |