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

Unified Diff: google_apis/gaia/fake_oauth2_token_service_delegate.h

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update for google_apis_unittests Created 5 years, 7 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
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

Powered by Google App Engine
This is Rietveld 408576698