Index: google_apis/gaia/fake_oauth2_token_service_delegate.cc |
diff --git a/google_apis/gaia/fake_oauth2_token_service_delegate.cc b/google_apis/gaia/fake_oauth2_token_service_delegate.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..70a36b855cb2d07c27d61da192f968f0e316d024 |
--- /dev/null |
+++ b/google_apis/gaia/fake_oauth2_token_service_delegate.cc |
@@ -0,0 +1,59 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "google_apis/gaia/fake_oauth2_token_service_delegate.h" |
+ |
+FakeOAuth2TokenServiceDelegate::FakeOAuth2TokenServiceDelegate() |
+ : request_context_(NULL) { |
+} |
+ |
+FakeOAuth2TokenServiceDelegate::~FakeOAuth2TokenServiceDelegate() { |
+} |
+ |
+std::vector<std::string> FakeOAuth2TokenServiceDelegate::GetAccounts() { |
+ return std::vector<std::string>(account_ids_.begin(), account_ids_.end()); |
+} |
+ |
+net::URLRequestContextGetter* |
+FakeOAuth2TokenServiceDelegate::GetRequestContext() const { |
+ return request_context_; |
+} |
+ |
+bool FakeOAuth2TokenServiceDelegate::RefreshTokenIsAvailable( |
+ const std::string& account_id) const { |
+ return account_ids_.count(account_id) != 0; |
+}; |
+ |
+std::string FakeOAuth2TokenServiceDelegate::GetRefreshToken( |
+ const std::string& account_id) const { |
+ return std::string(); |
+} |
+ |
+void FakeOAuth2TokenServiceDelegate::UpdateAuthError( |
+ const std::string& account_id, |
+ const GoogleServiceAuthError& error) { |
+} |
+ |
+void FakeOAuth2TokenServiceDelegate::RevokeAllCredentials() { |
+} |
+ |
+void FakeOAuth2TokenServiceDelegate::AddAccount(const std::string& account_id) { |
+ account_ids_.insert(account_id); |
+ FireRefreshTokenAvailable(account_id); |
+} |
+ |
+void FakeOAuth2TokenServiceDelegate::RemoveAccount( |
+ const std::string& account_id) { |
+ account_ids_.erase(account_id); |
+ FireRefreshTokenRevoked(account_id); |
+} |
+ |
+OAuth2AccessTokenFetcher* |
+FakeOAuth2TokenServiceDelegate::CreateAccessTokenFetcher( |
+ const std::string& account_id, |
+ net::URLRequestContextGetter* getter, |
+ OAuth2AccessTokenConsumer* consumer) { |
+ NOTREACHED(); |
+ return NULL; |
+} |