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

Unified Diff: google_apis/gaia/fake_oauth2_token_service_delegate.cc

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.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;
+}

Powered by Google App Engine
This is Rietveld 408576698