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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // Auth flow should change back to Gaia. | 411 // Auth flow should change back to Gaia. |
412 std::string message; | 412 std::string message; |
413 do { | 413 do { |
414 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 414 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
415 } while (message != "\"GaiaLoaded\""); | 415 } while (message != "\"GaiaLoaded\""); |
416 | 416 |
417 // Saml flow is gone. | 417 // Saml flow is gone. |
418 JsExpect("!$('gaia-signin').classList.contains('saml')"); | 418 JsExpect("!$('gaia-signin').classList.contains('saml')"); |
419 } | 419 } |
420 | 420 |
421 // Tests the sign-in flow when version 1 of the credentials passing API is used. | 421 // Tests the sign-in flow when the credentials passing API is used. |
422 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPIV1) { | 422 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPI) { |
423 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login_v1.html"); | 423 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login.html"); |
424 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html"); | 424 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html"); |
425 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); | 425 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); |
426 | 426 |
427 // Fill-in the SAML IdP form and submit. | |
428 SetSignFormField("Email", "fake_user"); | |
429 SetSignFormField("Password", "fake_password"); | |
430 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); | |
431 | |
432 // Login should finish login and a session should start. | |
433 content::WindowedNotificationObserver( | |
434 chrome::NOTIFICATION_SESSION_STARTED, | |
435 content::NotificationService::AllSources()).Wait(); | |
436 } | |
437 | |
438 // Tests the sign-in flow when version 2 of the credentials passing API is used. | |
439 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPIV2) { | |
440 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login_v2.html"); | |
441 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html"); | |
442 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); | |
443 | |
444 // Fill-in the SAML IdP form and submit. | 427 // Fill-in the SAML IdP form and submit. |
445 SetSignFormField("Email", "fake_user"); | 428 SetSignFormField("Email", "fake_user"); |
446 SetSignFormField("Password", "fake_password"); | 429 SetSignFormField("Password", "fake_password"); |
447 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); | 430 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
448 | 431 |
449 // Login should finish login and a session should start. | 432 // Login should finish login and a session should start. |
450 content::WindowedNotificationObserver( | 433 content::WindowedNotificationObserver( |
451 chrome::NOTIFICATION_SESSION_STARTED, | 434 chrome::NOTIFICATION_SESSION_STARTED, |
452 content::NotificationService::AllSources()).Wait(); | 435 content::NotificationService::AllSources()).Wait(); |
453 } | 436 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 711 |
729 // Verifies that when the offline login time limit is exceeded for a user who | 712 // Verifies that when the offline login time limit is exceeded for a user who |
730 // authenticated via SAML, that user is forced to log in online the next time. | 713 // authenticated via SAML, that user is forced to log in online the next time. |
731 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { | 714 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { |
732 login_screen_load_observer_->Wait(); | 715 login_screen_load_observer_->Wait(); |
733 // Verify that offline login is not allowed. | 716 // Verify that offline login is not allowed. |
734 JsExpect("!document.querySelector('#pod-row .signin-button').hidden"); | 717 JsExpect("!document.querySelector('#pod-row .signin-button').hidden"); |
735 } | 718 } |
736 | 719 |
737 } // namespace chromeos | 720 } // namespace chromeos |
OLD | NEW |