| 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 <memory> | 6 #include <memory> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 void FakeSamlIdp::SetCookieValue(const std::string& cookie_value) { | 210 void FakeSamlIdp::SetCookieValue(const std::string& cookie_value) { |
| 211 cookie_value_ = cookie_value; | 211 cookie_value_ = cookie_value; |
| 212 } | 212 } |
| 213 | 213 |
| 214 std::unique_ptr<HttpResponse> FakeSamlIdp::HandleRequest( | 214 std::unique_ptr<HttpResponse> FakeSamlIdp::HandleRequest( |
| 215 const HttpRequest& request) { | 215 const HttpRequest& request) { |
| 216 // The scheme and host of the URL is actually not important but required to | 216 // The scheme and host of the URL is actually not important but required to |
| 217 // get a valid GURL in order to parse |request.relative_url|. | 217 // get a valid GURL in order to parse |request.relative_url|. |
| 218 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); | 218 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); |
| 219 std::string request_path = request_url.path(); | 219 base::StringPiece request_path = request_url.path(); |
| 220 | 220 |
| 221 if (request_path == login_path_) { | 221 if (request_path == login_path_) { |
| 222 std::string relay_state; | 222 std::string relay_state; |
| 223 net::GetValueForKeyInQuery(request_url, kRelayState, &relay_state); | 223 net::GetValueForKeyInQuery(request_url, kRelayState, &relay_state); |
| 224 return BuildHTMLResponse(login_html_template_, | 224 return BuildHTMLResponse(login_html_template_, |
| 225 relay_state, | 225 relay_state, |
| 226 login_auth_path_); | 226 login_auth_path_); |
| 227 } | 227 } |
| 228 | 228 |
| 229 if (request_path != login_auth_path_) { | 229 if (request_path != login_auth_path_) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 ~SamlTest() override {} | 317 ~SamlTest() override {} |
| 318 | 318 |
| 319 void SetUpCommandLine(base::CommandLine* command_line) override { | 319 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 320 command_line->AppendSwitch(switches::kOobeSkipPostLogin); | 320 command_line->AppendSwitch(switches::kOobeSkipPostLogin); |
| 321 command_line->AppendSwitch( | 321 command_line->AppendSwitch( |
| 322 chromeos::switches::kAllowFailedPolicyFetchForTest); | 322 chromeos::switches::kAllowFailedPolicyFetchForTest); |
| 323 | 323 |
| 324 const GURL gaia_url = gaia_https_forwarder_.GetURLForSSLHost(""); | 324 const GURL gaia_url = gaia_https_forwarder_.GetURLForSSLHost(""); |
| 325 const GURL saml_idp_url = saml_https_forwarder_.GetURLForSSLHost("SAML"); | 325 const GURL saml_idp_url = saml_https_forwarder_.GetURLForSSLHost("SAML"); |
| 326 fake_saml_idp_.SetUp(saml_idp_url.path(), gaia_url); | 326 fake_saml_idp_.SetUp(saml_idp_url.path().as_string(), gaia_url); |
| 327 fake_gaia_->RegisterSamlUser(kFirstSAMLUserEmail, saml_idp_url); | 327 fake_gaia_->RegisterSamlUser(kFirstSAMLUserEmail, saml_idp_url); |
| 328 fake_gaia_->RegisterSamlUser(kSecondSAMLUserEmail, saml_idp_url); | 328 fake_gaia_->RegisterSamlUser(kSecondSAMLUserEmail, saml_idp_url); |
| 329 fake_gaia_->RegisterSamlUser( | 329 fake_gaia_->RegisterSamlUser( |
| 330 kHTTPSAMLUserEmail, | 330 kHTTPSAMLUserEmail, |
| 331 embedded_test_server()->base_url().Resolve("/SAML")); | 331 embedded_test_server()->base_url().Resolve("/SAML")); |
| 332 fake_gaia_->RegisterSamlUser(kDifferentDomainSAMLUserEmail, saml_idp_url); | 332 fake_gaia_->RegisterSamlUser(kDifferentDomainSAMLUserEmail, saml_idp_url); |
| 333 fake_gaia_->RegisterSamlDomainRedirectUrl("example.com", saml_idp_url); | 333 fake_gaia_->RegisterSamlDomainRedirectUrl("example.com", saml_idp_url); |
| 334 | 334 |
| 335 OobeBaseTest::SetUpCommandLine(command_line); | 335 OobeBaseTest::SetUpCommandLine(command_line); |
| 336 } | 336 } |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 | 1397 |
| 1398 // Scraping one password should finish login. | 1398 // Scraping one password should finish login. |
| 1399 content::WindowedNotificationObserver session_start_waiter( | 1399 content::WindowedNotificationObserver session_start_waiter( |
| 1400 chrome::NOTIFICATION_SESSION_STARTED, | 1400 chrome::NOTIFICATION_SESSION_STARTED, |
| 1401 content::NotificationService::AllSources()); | 1401 content::NotificationService::AllSources()); |
| 1402 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); | 1402 ExecuteJsInSigninFrame("document.getElementById('Submit').click();"); |
| 1403 session_start_waiter.Wait(); | 1403 session_start_waiter.Wait(); |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 } // namespace chromeos | 1406 } // namespace chromeos |
| OLD | NEW |