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

Unified Diff: google_apis/gaia/fake_oauth2_token_service.h

Issue 336253002: Add IdentityProvider-based AccountTracker to google_apis (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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.h
diff --git a/google_apis/gaia/fake_oauth2_token_service.h b/google_apis/gaia/fake_oauth2_token_service.h
index 8c267e5b99a5143504bf41e5723da97a7da21080..3bdb67500a96739511fca9a4375f95237c4db699 100644
--- a/google_apis/gaia/fake_oauth2_token_service.h
+++ b/google_apis/gaia/fake_oauth2_token_service.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
#include "google_apis/gaia/oauth2_token_service.h"
namespace net {
@@ -21,7 +22,15 @@ class FakeOAuth2TokenService : public OAuth2TokenService {
FakeOAuth2TokenService();
virtual ~FakeOAuth2TokenService();
+ virtual std::vector<std::string> GetAccounts() OVERRIDE;
+
void AddAccount(const std::string& account_id);
+ void RemoveAccount(const std::string& account_id);
+
+ // Helper routines to issue tokens for pending requests.
+ void IssueAllTokensForAccount(const std::string& account_id,
+ const std::string& access_token,
+ const base::Time& expiration);
void set_request_context(net::URLRequestContextGetter* request_context) {
request_context_ = request_context;
@@ -45,6 +54,17 @@ class FakeOAuth2TokenService : public OAuth2TokenService {
OVERRIDE;
private:
+ struct PendingRequest {
+ PendingRequest();
+ ~PendingRequest();
+
+ std::string account_id;
+ std::string client_id;
+ std::string client_secret;
+ ScopeSet scopes;
+ base::WeakPtr<RequestImpl> request;
+ };
+
// OAuth2TokenService overrides.
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
@@ -54,6 +74,8 @@ class FakeOAuth2TokenService : public OAuth2TokenService {
OAuth2AccessTokenConsumer* consumer) OVERRIDE;
std::set<std::string> account_ids_;
+ std::vector<PendingRequest> pending_requests_;
+
net::URLRequestContextGetter* request_context_; // weak
DISALLOW_COPY_AND_ASSIGN(FakeOAuth2TokenService);

Powered by Google App Engine
This is Rietveld 408576698