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 <cstring> | 5 #include <cstring> |
6 #include <string> | 6 #include <string> |
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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 content::WindowedNotificationObserver( | 1118 content::WindowedNotificationObserver( |
1119 chrome::NOTIFICATION_SESSION_STARTED, | 1119 chrome::NOTIFICATION_SESSION_STARTED, |
1120 content::NotificationService::AllSources()).Wait(); | 1120 content::NotificationService::AllSources()).Wait(); |
1121 } | 1121 } |
1122 | 1122 |
1123 // Verifies that the offline login time limit does not affect a user who | 1123 // Verifies that the offline login time limit does not affect a user who |
1124 // authenticated without SAML. | 1124 // authenticated without SAML. |
1125 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, NoSAML) { | 1125 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, NoSAML) { |
1126 login_screen_load_observer_->Wait(); | 1126 login_screen_load_observer_->Wait(); |
1127 // Verify that offline login is allowed. | 1127 // Verify that offline login is allowed. |
1128 JsExpect("window.getComputedStyle(document.querySelector(" | 1128 JsExpect( |
1129 " '#pod-row .signin-button-container')).display == 'none'"); | 1129 "window.getComputedStyle(document.querySelector(" |
| 1130 " '#pod-row .reauth-hint-container')).display == 'none'"); |
1130 } | 1131 } |
1131 | 1132 |
1132 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_SAMLNoLimit) { | 1133 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_SAMLNoLimit) { |
1133 // Remove the offline login time limit for SAML users. | 1134 // Remove the offline login time limit for SAML users. |
1134 SetSAMLOfflineSigninTimeLimitPolicy(-1); | 1135 SetSAMLOfflineSigninTimeLimitPolicy(-1); |
1135 | 1136 |
1136 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); | 1137 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); |
1137 } | 1138 } |
1138 | 1139 |
1139 // Verifies that when no offline login time limit is set, a user who | 1140 // Verifies that when no offline login time limit is set, a user who |
1140 // authenticated with SAML is allowed to log in offline. | 1141 // authenticated with SAML is allowed to log in offline. |
1141 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, SAMLNoLimit) { | 1142 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, SAMLNoLimit) { |
1142 login_screen_load_observer_->Wait(); | 1143 login_screen_load_observer_->Wait(); |
1143 // Verify that offline login is allowed. | 1144 // Verify that offline login is allowed. |
1144 JsExpect("window.getComputedStyle(document.querySelector(" | 1145 JsExpect( |
1145 " '#pod-row .signin-button-container')).display == 'none'"); | 1146 "window.getComputedStyle(document.querySelector(" |
| 1147 " '#pod-row .reauth-hint-container')).display == 'none'"); |
1146 } | 1148 } |
1147 | 1149 |
1148 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_SAMLZeroLimit) { | 1150 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_SAMLZeroLimit) { |
1149 // Set the offline login time limit for SAML users to zero. | 1151 // Set the offline login time limit for SAML users to zero. |
1150 SetSAMLOfflineSigninTimeLimitPolicy(0); | 1152 SetSAMLOfflineSigninTimeLimitPolicy(0); |
1151 | 1153 |
1152 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); | 1154 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); |
1153 } | 1155 } |
1154 | 1156 |
1155 // Verifies that when the offline login time limit is exceeded for a user who | 1157 // Verifies that when the offline login time limit is exceeded for a user who |
1156 // authenticated via SAML, that user is forced to log in online the next time. | 1158 // authenticated via SAML, that user is forced to log in online the next time. |
1157 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, SAMLZeroLimit) { | 1159 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, SAMLZeroLimit) { |
1158 login_screen_load_observer_->Wait(); | 1160 login_screen_load_observer_->Wait(); |
1159 // Verify that offline login is not allowed. | 1161 // Verify that offline login is not allowed. |
1160 JsExpect("window.getComputedStyle(document.querySelector(" | 1162 JsExpect( |
1161 " '#pod-row .signin-button-container')).display != 'none'"); | 1163 "window.getComputedStyle(document.querySelector(" |
| 1164 " '#pod-row .reauth-hint-container')).display != 'none'"); |
1162 } | 1165 } |
1163 | 1166 |
1164 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_PRE_TransferCookiesAffiliated) { | 1167 IN_PROC_BROWSER_TEST_P(SAMLPolicyTest, PRE_PRE_TransferCookiesAffiliated) { |
1165 fake_saml_idp()->SetCookieValue(kSAMLIdPCookieValue1); | 1168 fake_saml_idp()->SetCookieValue(kSAMLIdPCookieValue1); |
1166 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); | 1169 LogInWithSAML(kFirstSAMLUserEmail, kTestAuthSIDCookie1, kTestAuthLSIDCookie1); |
1167 | 1170 |
1168 GetCookies(); | 1171 GetCookies(); |
1169 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); | 1172 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); |
1170 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); | 1173 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); |
1171 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); | 1174 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); | 1238 EXPECT_EQ(kTestAuthSIDCookie1, GetCookieValue(kGAIASIDCookieName)); |
1236 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); | 1239 EXPECT_EQ(kTestAuthLSIDCookie1, GetCookieValue(kGAIALSIDCookieName)); |
1237 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); | 1240 EXPECT_EQ(kSAMLIdPCookieValue1, GetCookieValue(kSAMLIdPCookieName)); |
1238 } | 1241 } |
1239 | 1242 |
1240 INSTANTIATE_TEST_CASE_P(SamlSuite, | 1243 INSTANTIATE_TEST_CASE_P(SamlSuite, |
1241 SAMLPolicyTest, | 1244 SAMLPolicyTest, |
1242 testing::Bool()); | 1245 testing::Bool()); |
1243 | 1246 |
1244 } // namespace chromeos | 1247 } // namespace chromeos |
OLD | NEW |