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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "google_apis/gaia/fake_oauth2_token_service_delegate.h"
6
7 FakeOAuth2TokenServiceDelegate::FakeOAuth2TokenServiceDelegate()
8 : request_context_(NULL) {
9 }
10
11 FakeOAuth2TokenServiceDelegate::~FakeOAuth2TokenServiceDelegate() {
12 }
13
14 std::vector<std::string> FakeOAuth2TokenServiceDelegate::GetAccounts() {
15 return std::vector<std::string>(account_ids_.begin(), account_ids_.end());
16 }
17
18 net::URLRequestContextGetter*
19 FakeOAuth2TokenServiceDelegate::GetRequestContext() const {
20 return request_context_;
21 }
22
23 bool FakeOAuth2TokenServiceDelegate::RefreshTokenIsAvailable(
24 const std::string& account_id) const {
25 return account_ids_.count(account_id) != 0;
26 };
27
28 std::string FakeOAuth2TokenServiceDelegate::GetRefreshToken(
29 const std::string& account_id) const {
30 return std::string();
31 }
32
33 void FakeOAuth2TokenServiceDelegate::UpdateAuthError(
34 const std::string& account_id,
35 const GoogleServiceAuthError& error) {
36 }
37
38 void FakeOAuth2TokenServiceDelegate::RevokeAllCredentials() {
39 }
40
41 void FakeOAuth2TokenServiceDelegate::AddAccount(const std::string& account_id) {
42 account_ids_.insert(account_id);
43 FireRefreshTokenAvailable(account_id);
44 }
45
46 void FakeOAuth2TokenServiceDelegate::RemoveAccount(
47 const std::string& account_id) {
48 account_ids_.erase(account_id);
49 FireRefreshTokenRevoked(account_id);
50 }
51
52 OAuth2AccessTokenFetcher*
53 FakeOAuth2TokenServiceDelegate::CreateAccessTokenFetcher(
54 const std::string& account_id,
55 net::URLRequestContextGetter* getter,
56 OAuth2AccessTokenConsumer* consumer) {
57 NOTREACHED();
58 return NULL;
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698