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..9f922c8a008fc033dd94e8cf1ae2398753ecac70 100644 |
--- a/google_apis/gaia/fake_oauth2_token_service.cc |
+++ b/google_apis/gaia/fake_oauth2_token_service.cc |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
#include "google_apis/gaia/fake_oauth2_token_service.h" |
+#include "google_apis/gaia/fake_oauth2_token_service_delegate.h" |
FakeOAuth2TokenService::PendingRequest::PendingRequest() { |
} |
@@ -10,16 +11,13 @@ FakeOAuth2TokenService::PendingRequest::PendingRequest() { |
FakeOAuth2TokenService::PendingRequest::~PendingRequest() { |
} |
-FakeOAuth2TokenService::FakeOAuth2TokenService() : request_context_(NULL) { |
+FakeOAuth2TokenService::FakeOAuth2TokenService() |
+ : OAuth2TokenService(new FakeOAuth2TokenServiceDelegate()) { |
} |
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, |
@@ -43,23 +41,14 @@ void FakeOAuth2TokenService::InvalidateOAuth2Token( |
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); |
+ static_cast<FakeOAuth2TokenServiceDelegate*>(GetDelegate()) |
+ ->AddAccount(account_id); |
} |
void FakeOAuth2TokenService::RemoveAccount(const std::string& account_id) { |
- account_ids_.erase(account_id); |
- FireRefreshTokenRevoked(account_id); |
+ static_cast<FakeOAuth2TokenServiceDelegate*>(GetDelegate()) |
+ ->RemoveAccount(account_id); |
Roger Tawa OOO till Jul 10th
2015/05/28 14:54:44
Should not need casts here and line 45.
gogerald1
2015/06/03 18:12:58
Done.
|
} |
void FakeOAuth2TokenService::IssueAllTokensForAccount( |
@@ -96,12 +85,8 @@ 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; |
-} |
+void FakeOAuth2TokenService::set_request_context( |
+ net::URLRequestContextGetter* request_context) { |
+ static_cast<FakeOAuth2TokenServiceDelegate*>(GetDelegate()) |
+ ->set_request_context(request_context); |
+} |