Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/chromeos/login/saml/saml_browsertest.cc

Issue 258123002: Implement a second version of the credentials passing API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more s/requested_version/requestedVersion/ I had missed. Thank you for catching this, browser_t… Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth/background.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // Auth flow should change back to Gaia. 410 // Auth flow should change back to Gaia.
411 std::string message; 411 std::string message;
412 do { 412 do {
413 ASSERT_TRUE(message_queue.WaitForMessage(&message)); 413 ASSERT_TRUE(message_queue.WaitForMessage(&message));
414 } while (message != "\"GaiaLoaded\""); 414 } while (message != "\"GaiaLoaded\"");
415 415
416 // Saml flow is gone. 416 // Saml flow is gone.
417 JsExpect("!$('gaia-signin').classList.contains('saml')"); 417 JsExpect("!$('gaia-signin').classList.contains('saml')");
418 } 418 }
419 419
420 // Tests the sign-in flow when the credentials passing API is used. 420 // Tests the sign-in flow when version 1 of the credentials passing API is used.
421 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPI) { 421 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPIV1) {
422 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login.html"); 422 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login_v1.html");
423 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html"); 423 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html");
424 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail); 424 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail);
425 425
426 // Fill-in the SAML IdP form and submit.
427 SetSignFormField("Email", "fake_user");
428 SetSignFormField("Password", "fake_password");
429 ExecuteJsInSigninFrame("document.getElementById('Submit').click();");
430
431 // Login should finish login and a session should start.
432 content::WindowedNotificationObserver(
433 chrome::NOTIFICATION_SESSION_STARTED,
434 content::NotificationService::AllSources()).Wait();
435 }
436
437 // Tests the sign-in flow when version 2 of the credentials passing API is used.
438 IN_PROC_BROWSER_TEST_F(SamlTest, CredentialPassingAPIV2) {
439 fake_saml_idp()->SetLoginHTMLTemplate("saml_api_login_v2.html");
440 fake_saml_idp()->SetLoginAuthHTMLTemplate("saml_api_login_auth.html");
441 StartSamlAndWaitForIdpPageLoad(kFirstSAMLUserEmail);
442
426 // Fill-in the SAML IdP form and submit. 443 // Fill-in the SAML IdP form and submit.
427 SetSignFormField("Email", "fake_user"); 444 SetSignFormField("Email", "fake_user");
428 SetSignFormField("Password", "fake_password"); 445 SetSignFormField("Password", "fake_password");
429 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); 446 ExecuteJsInSigninFrame("document.getElementById('Submit').click();");
430 447
431 // Login should finish login and a session should start. 448 // Login should finish login and a session should start.
432 content::WindowedNotificationObserver( 449 content::WindowedNotificationObserver(
433 chrome::NOTIFICATION_SESSION_STARTED, 450 chrome::NOTIFICATION_SESSION_STARTED,
434 content::NotificationService::AllSources()).Wait(); 451 content::NotificationService::AllSources()).Wait();
435 } 452 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 724
708 // Verifies that when the offline login time limit is exceeded for a user who 725 // Verifies that when the offline login time limit is exceeded for a user who
709 // authenticated via SAML, that user is forced to log in online the next time. 726 // authenticated via SAML, that user is forced to log in online the next time.
710 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) { 727 IN_PROC_BROWSER_TEST_F(SAMLPolicyTest, SAMLZeroLimit) {
711 login_screen_load_observer_->Wait(); 728 login_screen_load_observer_->Wait();
712 // Verify that offline login is not allowed. 729 // Verify that offline login is not allowed.
713 JsExpect("!document.querySelector('#pod-row .signin-button').hidden"); 730 JsExpect("!document.querySelector('#pod-row .signin-button').hidden");
714 } 731 }
715 732
716 } // namespace chromeos 733 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698