| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 content::WindowedNotificationObserver( | 673 content::WindowedNotificationObserver( |
| 674 chrome::NOTIFICATION_SESSION_STARTED, | 674 chrome::NOTIFICATION_SESSION_STARTED, |
| 675 content::NotificationService::AllSources()).Wait(); | 675 content::NotificationService::AllSources()).Wait(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 // Verifies that the offline login time limit does not affect a user who | 678 // Verifies that the offline login time limit does not affect a user who |
| 679 // authenticated without SAML. | 679 // authenticated without SAML. |
| 680 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, NoSAML) { | 680 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, NoSAML) { |
| 681 login_screen_load_observer_->Wait(); | 681 login_screen_load_observer_->Wait(); |
| 682 // Verify that offline login is allowed. | 682 // Verify that offline login is allowed. |
| 683 JsExpect("document.querySelector('#pod-row .signin-button').hidden"); | 683 JsExpect("window.getComputedStyle(document.querySelector(" |
| 684 " '#pod-row .signin-button-container')).display == 'none'"); |
| 684 } | 685 } |
| 685 | 686 |
| 686 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, PRE_SAMLNoLimit) { | 687 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, PRE_SAMLNoLimit) { |
| 687 // Remove the offline login time limit for SAML users. | 688 // Remove the offline login time limit for SAML users. |
| 688 SetSAMLOfflineSigninTimeLimitPolicy(-1); | 689 SetSAMLOfflineSigninTimeLimitPolicy(-1); |
| 689 | 690 |
| 690 // Log in with SAML. | 691 // Log in with SAML. |
| 691 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); | 692 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); |
| 692 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); | 693 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); |
| 693 | 694 |
| 694 SetSignFormField("Email", "fake_user"); | 695 SetSignFormField("Email", "fake_user"); |
| 695 SetSignFormField("Password", "fake_password"); | 696 SetSignFormField("Password", "fake_password"); |
| 696 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); | 697 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
| 697 | 698 |
| 698 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 699 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
| 699 | 700 |
| 700 SendConfirmPassword("fake_password"); | 701 SendConfirmPassword("fake_password"); |
| 701 content::WindowedNotificationObserver( | 702 content::WindowedNotificationObserver( |
| 702 chrome::NOTIFICATION_SESSION_STARTED, | 703 chrome::NOTIFICATION_SESSION_STARTED, |
| 703 content::NotificationService::AllSources()).Wait(); | 704 content::NotificationService::AllSources()).Wait(); |
| 704 } | 705 } |
| 705 | 706 |
| 706 // Verifies that when no offline login time limit is set, a user who | 707 // Verifies that when no offline login time limit is set, a user who |
| 707 // authenticated with SAML is allowed to log in offline. | 708 // authenticated with SAML is allowed to log in offline. |
| 708 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLNoLimit) { | 709 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLNoLimit) { |
| 709 login_screen_load_observer_->Wait(); | 710 login_screen_load_observer_->Wait(); |
| 710 // Verify that offline login is allowed. | 711 // Verify that offline login is allowed. |
| 711 JsExpect("document.querySelector('#pod-row .signin-button').hidden"); | 712 JsExpect("window.getComputedStyle(document.querySelector(" |
| 713 " '#pod-row .signin-button-container')).display == 'none'"); |
| 712 } | 714 } |
| 713 | 715 |
| 714 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, PRE_SAMLZeroLimit) { | 716 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, PRE_SAMLZeroLimit) { |
| 715 // Set the offline login time limit for SAML users to zero. | 717 // Set the offline login time limit for SAML users to zero. |
| 716 SetSAMLOfflineSigninTimeLimitPolicy(0); | 718 SetSAMLOfflineSigninTimeLimitPolicy(0); |
| 717 | 719 |
| 718 // Log in with SAML. | 720 // Log in with SAML. |
| 719 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); | 721 fake_saml_idp()->SetLoginHTMLTemplate("saml_login.html"); |
| 720 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); | 722 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); |
| 721 | 723 |
| 722 SetSignFormField("Email", "fake_user"); | 724 SetSignFormField("Email", "fake_user"); |
| 723 SetSignFormField("Password", "fake_password"); | 725 SetSignFormField("Password", "fake_password"); |
| 724 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); | 726 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
| 725 | 727 |
| 726 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); | 728 OobeScreenWaiter(OobeDisplay::SCREEN_CONFIRM_PASSWORD).Wait(); |
| 727 | 729 |
| 728 SendConfirmPassword("fake_password"); | 730 SendConfirmPassword("fake_password"); |
| 729 content::WindowedNotificationObserver( | 731 content::WindowedNotificationObserver( |
| 730 chrome::NOTIFICATION_SESSION_STARTED, | 732 chrome::NOTIFICATION_SESSION_STARTED, |
| 731 content::NotificationService::AllSources()).Wait(); | 733 content::NotificationService::AllSources()).Wait(); |
| 732 } | 734 } |
| 733 | 735 |
| 734 // Verifies that when the offline login time limit is exceeded for a user who | 736 // Verifies that when the offline login time limit is exceeded for a user who |
| 735 // authenticated via SAML, that user is forced to log in online the next time. | 737 // authenticated via SAML, that user is forced to log in online the next time. |
| 736 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { | 738 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { |
| 737 login_screen_load_observer_->Wait(); | 739 login_screen_load_observer_->Wait(); |
| 738 // Verify that offline login is not allowed. | 740 // Verify that offline login is not allowed. |
| 739 JsExpect("!document.querySelector('#pod-row .signin-button').hidden"); | 741 JsExpect("window.getComputedStyle(document.querySelector(" |
| 742 " '#pod-row .signin-button-container')).display != 'none'"); |
| 740 } | 743 } |
| 741 | 744 |
| 742 } // namespace chromeos | 745 } // namespace chromeos |
| OLD | NEW |