| 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,
|
|
|