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

Unified Diff: google_apis/gaia/fake_oauth2_token_service.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 6 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_oauth2_token_service.h ('k') | google_apis/gaia/fake_oauth2_token_service_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/fake_oauth2_token_service.cc
diff --git a/google_apis/gaia/fake_oauth2_token_service.cc b/google_apis/gaia/fake_oauth2_token_service.cc
index adff32d321986d259f5ca8e6a361dcc80bf5a134..55b5cd58a1e5fabf05f79b8114995d4054a844d2 100644
--- a/google_apis/gaia/fake_oauth2_token_service.cc
+++ b/google_apis/gaia/fake_oauth2_token_service.cc
@@ -10,16 +10,13 @@ FakeOAuth2TokenService::PendingRequest::PendingRequest() {
FakeOAuth2TokenService::PendingRequest::~PendingRequest() {
}
-FakeOAuth2TokenService::FakeOAuth2TokenService() : request_context_(NULL) {
+FakeOAuth2TokenService::FakeOAuth2TokenService()
+ : OAuth2TokenService(new FakeOAuth2TokenServiceDelegate(nullptr)) {
}
FakeOAuth2TokenService::~FakeOAuth2TokenService() {
}
-std::vector<std::string> FakeOAuth2TokenService::GetAccounts() {
- return std::vector<std::string>(account_ids_.begin(), account_ids_.end());
-}
-
void FakeOAuth2TokenService::FetchOAuth2Token(
RequestImpl* request,
const std::string& account_id,
@@ -36,30 +33,19 @@ void FakeOAuth2TokenService::FetchOAuth2Token(
pending_requests_.push_back(pending_request);
}
-void FakeOAuth2TokenService::InvalidateOAuth2Token(
+void FakeOAuth2TokenService::InvalidateAccessTokenImpl(
const std::string& account_id,
const std::string& client_id,
const ScopeSet& scopes,
const std::string& access_token) {
}
-net::URLRequestContextGetter* FakeOAuth2TokenService::GetRequestContext() {
- return request_context_;
-}
-
-bool FakeOAuth2TokenService::RefreshTokenIsAvailable(
- const std::string& account_id) const {
- return account_ids_.count(account_id) != 0;
-};
-
void FakeOAuth2TokenService::AddAccount(const std::string& account_id) {
- account_ids_.insert(account_id);
- FireRefreshTokenAvailable(account_id);
+ GetDelegate()->UpdateCredentials(account_id, "fake_refresh_token");
}
void FakeOAuth2TokenService::RemoveAccount(const std::string& account_id) {
- account_ids_.erase(account_id);
- FireRefreshTokenRevoked(account_id);
+ GetDelegate()->RevokeCredentials(account_id);
}
void FakeOAuth2TokenService::IssueAllTokensForAccount(
@@ -96,12 +82,7 @@ void FakeOAuth2TokenService::IssueErrorForAllPendingRequestsForAccount(
}
}
-OAuth2AccessTokenFetcher* FakeOAuth2TokenService::CreateAccessTokenFetcher(
- const std::string& account_id,
- net::URLRequestContextGetter* getter,
- OAuth2AccessTokenConsumer* consumer) {
- // |FakeOAuth2TokenService| overrides |FetchOAuth2Token| and thus
- // |CreateAccessTokenFetcher| should never be called.
- NOTREACHED();
- return NULL;
+FakeOAuth2TokenServiceDelegate*
+FakeOAuth2TokenService::GetFakeOAuth2TokenServiceDelegate() {
+ return static_cast<FakeOAuth2TokenServiceDelegate*>(GetDelegate());
}
« no previous file with comments | « google_apis/gaia/fake_oauth2_token_service.h ('k') | google_apis/gaia/fake_oauth2_token_service_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698