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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
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 <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
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/fake_cws.cc ('k') | chrome/browser/chromeos/login/signin/oauth2_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698