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()); |
} |