Skip to content

Commit

Permalink
[signin] Fix first party URL in GaiaAuthFetcher
Browse files Browse the repository at this point in the history
Bug: 882107
Change-Id: Ie36e139d17b03bfd75f3b1cec9d557ec5513b084
Reviewed-on: https://chromium-review.googlesource.com/1236214
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592896}
  • Loading branch information
David Roger authored and Commit Bot committed Sep 20, 2018
1 parent da20b6a commit 5307e88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions google_apis/gaia/gaia_auth_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ void GaiaAuthFetcher::CreateAndStartGaiaFetcher(
resource_request->url = gaia_gurl;
original_url_ = gaia_gurl;

if (!(load_flags & net::LOAD_DO_NOT_SEND_COOKIES)) {
DCHECK_EQ(GaiaUrls::GetInstance()->gaia_url(), gaia_gurl.GetOrigin())
<< gaia_gurl;
resource_request->site_for_cookies = GaiaUrls::GetInstance()->gaia_url();
}

if (!body.empty())
resource_request->method = "POST";

Expand Down
10 changes: 4 additions & 6 deletions google_apis/gaia/gaia_auth_fetcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ class GaiaAuthFetcherTest : public testing::Test {
return test_shared_loader_factory_;
}

bool WasLastURLServed(const GURL& url) {
if (received_requests_.empty())
return false;
return received_requests_.back().url == url;
}

base::test::ScopedTaskEnvironment scoped_task_environment_;
network::TestURLLoaderFactory test_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
Expand Down Expand Up @@ -435,6 +429,10 @@ TEST_F(GaiaAuthFetcherTest, ListAccounts) {
/*body=*/"", /*headers=*/"",
GaiaUrls::GetInstance()->ListAccountsURLWithSource(std::string()),
/*load_flags=*/0, NO_TRAFFIC_ANNOTATION_YET);
ASSERT_EQ(received_requests_.size(), 1U);
EXPECT_EQ(net::LOAD_NORMAL, received_requests_.at(0).load_flags);
EXPECT_EQ(GaiaUrls::GetInstance()->gaia_url(),
received_requests_.at(0).site_for_cookies);
auth.TestOnURLLoadCompleteInternal(net::OK, net::HTTP_OK, {}, data);
}

Expand Down

0 comments on commit 5307e88

Please sign in to comment.