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

Unified Diff: chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc

Issue 257773002: Use new people.get api instead of oauth2/v1/userinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix user image manager tests Created 6 years, 8 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
Index: chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
index f9e490ced89eb7f3c52f73ce98fce4a5a660ddf8..c80c62e526c6c61c4cd9238fa7a3170336ffd218 100644
--- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
+++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc
@@ -36,6 +36,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/gaia/gaia_constants.h"
+#include "google_apis/gaia/gaia_oauth_client.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -74,7 +75,7 @@ const char kValidTokenResponse[] =
const char kHostedDomainResponse[] =
"{"
- " \"hd\": \"test.com\""
+ " \"domain\": \"test.com\""
"}";
class SigninManagerFake : public FakeSigninManager {
@@ -231,10 +232,15 @@ class UserPolicySigninServiceTest : public testing::Test {
return static_cast<FakeProfileOAuth2TokenService*>(service);
}
+ // Returns true if a request for policy information is active. A request
+ // is considered active if there is an active fetcher for an access token
+ // hosted domain information (i.e. the gaia oauth client) or some other
+ // fecther used in the code (id 0).
bool IsRequestActive() {
if (!GetTokenService()->GetPendingRequests().empty())
return true;
- return url_factory_.GetFetcherByID(0);
+ return url_factory_.GetFetcherByID(0) ||
+ url_factory_.GetFetcherByID(gaia::GaiaOAuthClient::kUrlFetcherId);
}
void MakeOAuthTokenFetchSucceed() {
@@ -252,7 +258,8 @@ class UserPolicySigninServiceTest : public testing::Test {
void ReportHostedDomainStatus(bool is_hosted_domain) {
ASSERT_TRUE(IsRequestActive());
- net::TestURLFetcher* fetcher = url_factory_.GetFetcherByID(0);
+ net::TestURLFetcher* fetcher =
+ url_factory_.GetFetcherByID(gaia::GaiaOAuthClient::kUrlFetcherId);
fetcher->set_response_code(net::HTTP_OK);
fetcher->SetResponseString(is_hosted_domain ? kHostedDomainResponse : "{}");
fetcher->delegate()->OnURLFetchComplete(fetcher);
« no previous file with comments | « chrome/browser/chromeos/policy/wildcard_login_checker.cc ('k') | chrome/browser/profiles/profile_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698