Index: google_apis/gaia/fake_oauth2_token_service_delegate.h |
diff --git a/google_apis/gaia/fake_oauth2_token_service_delegate.h b/google_apis/gaia/fake_oauth2_token_service_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..789e518eec95a6795fc3ad6dd43983cfa2e910e5 |
--- /dev/null |
+++ b/google_apis/gaia/fake_oauth2_token_service_delegate.h |
@@ -0,0 +1,49 @@ |
+#ifndef GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
+#define GOOGLE_APIS_GAIA_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
+ |
+#include <set> |
+#include <string> |
+ |
+#include "google_apis/gaia/oauth2_token_service_delegate.h" |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
+class FakeOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate { |
+ public: |
+ FakeOAuth2TokenServiceDelegate(); |
+ ~FakeOAuth2TokenServiceDelegate() override; |
+ |
+ // OAuth2TokenService overrides. |
+ net::URLRequestContextGetter* GetRequestContext() const override; |
+ |
+ OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
+ const std::string& account_id, |
+ net::URLRequestContextGetter* getter, |
+ OAuth2AccessTokenConsumer* consumer) override; |
+ |
+ bool RefreshTokenIsAvailable(const std::string& account_id) const override; |
+ std::string GetRefreshToken(const std::string& account_id) const override; |
+ void UpdateAuthError(const std::string& account_id, |
+ const GoogleServiceAuthError& error) override; |
+ |
+ std::vector<std::string> GetAccounts() override; |
+ void RevokeAllCredentials() override; |
+ |
+ void AddAccount(const std::string& account_id); |
+ void RemoveAccount(const std::string& account_id); |
+ |
+ void set_request_context(net::URLRequestContextGetter* request_context) { |
+ request_context_ = request_context; |
+ } |
+ |
+ private: |
+ std::set<std::string> account_ids_; |
+ |
+ net::URLRequestContextGetter* request_context_; // weak |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FakeOAuth2TokenServiceDelegate); |
+}; |
+ |
+#endif |