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

Unified Diff: google_apis/gaia/fake_gaia.cc

Issue 1004753004: cros: Port SAML support to webview sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle loadabort to fix test Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gaia/fake_gaia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/fake_gaia.cc
diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc
index a7402323ec04a005bfe35aaf90ddc33dfdf3a73c..c755cda54b06318fa88a728b832a7f296c4b9574 100644
--- a/google_apis/gaia/fake_gaia.cc
+++ b/google_apis/gaia/fake_gaia.cc
@@ -133,7 +133,7 @@ FakeGaia::MergeSessionParams::MergeSessionParams() {
FakeGaia::MergeSessionParams::~MergeSessionParams() {
}
-FakeGaia::FakeGaia() {
+FakeGaia::FakeGaia() : issue_oauth_code_cookie_(false) {
base::FilePath source_root_dir;
PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir);
CHECK(base::ReadFileToString(
@@ -189,6 +189,15 @@ void FakeGaia::AddGoogleAccountsSigninHeader(
email.c_str(), GetGaiaIdOfEmail(email).c_str()));
}
+void FakeGaia::SetOAuthCodeCookie(
+ net::test_server::BasicHttpResponse* http_response) const {
+ http_response->AddCustomHeader(
+ "Set-Cookie",
+ base::StringPrintf(
+ "oauth_code=%s; Path=/o/GetOAuth2Token; Secure; HttpOnly;",
+ merge_session_params_.auth_code.c_str()));
+}
+
void FakeGaia::Initialize() {
GaiaUrls* gaia_urls = GaiaUrls::GetInstance();
// Handles /MergeSession GAIA call.
@@ -483,6 +492,8 @@ void FakeGaia::HandleServiceLoginAuth(const HttpRequest& request,
return;
AddGoogleAccountsSigninHeader(http_response, email);
+ if (issue_oauth_code_cookie_)
+ SetOAuthCodeCookie(http_response);
}
void FakeGaia::HandleSSO(const HttpRequest& request,
@@ -502,6 +513,9 @@ void FakeGaia::HandleSSO(const HttpRequest& request,
if (!merge_session_params_.email.empty())
AddGoogleAccountsSigninHeader(http_response, merge_session_params_.email);
+
+ if (issue_oauth_code_cookie_)
+ SetOAuthCodeCookie(http_response);
}
void FakeGaia::HandleAuthToken(const HttpRequest& request,
« no previous file with comments | « google_apis/gaia/fake_gaia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698