1 // Copyright 2014 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.
5 #include "google_apis/gaia/fake_oauth2_token_service.h"
7 FakeOAuth2TokenService::FakeOAuth2TokenService() : request_context_(NULL
) {}
9 FakeOAuth2TokenService::~FakeOAuth2TokenService() {
12 void FakeOAuth2TokenService::FetchOAuth2Token(
14 const std::string
& account_id
,
15 net::URLRequestContextGetter
* getter
,
16 const std::string
& client_id
,
17 const std::string
& client_secret
,
18 const ScopeSet
& scopes
) {
21 void FakeOAuth2TokenService::InvalidateOAuth2Token(
22 const std::string
& account_id
,
23 const std::string
& client_id
,
24 const ScopeSet
& scopes
,
25 const std::string
& access_token
) {
28 net::URLRequestContextGetter
* FakeOAuth2TokenService::GetRequestContext() {
29 return request_context_
;
32 bool FakeOAuth2TokenService::RefreshTokenIsAvailable(
33 const std::string
& account_id
) const {
34 return account_ids_
.count(account_id
) != 0;
37 void FakeOAuth2TokenService::AddAccount(const std::string
& account_id
) {
38 account_ids_
.insert(account_id
);
41 OAuth2AccessTokenFetcher
* FakeOAuth2TokenService::CreateAccessTokenFetcher(
42 const std::string
& account_id
,
43 net::URLRequestContextGetter
* getter
,
44 OAuth2AccessTokenConsumer
* consumer
) {
45 // |FakeOAuth2TokenService| overrides |FetchOAuth2Token| and thus
46 // |CreateAccessTokenFetcher| should never be called.