1 // Copyright 2013 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 "chrome/browser/sync/fake_oauth2_token_service.h"
6
7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/browser_context.h"
10
FetchOAuth2Token(OAuth2TokenService::RequestImpl * request,const std::string & account_id,net::URLRequestContextGetter * getter,const std::string & client_id,const std::string & client_secret,const OAuth2TokenService::ScopeSet & scopes)11 void FakeOAuth2TokenService::FetchOAuth2Token(
12 OAuth2TokenService::RequestImpl* request,
13 const std::string& account_id,
14 net::URLRequestContextGetter* getter,
15 const std::string& client_id,
16 const std::string& client_secret,
17 const OAuth2TokenService::ScopeSet& scopes) {
18 // Request will succeed without network IO.
19 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
20 &RequestImpl::InformConsumer,
21 request->AsWeakPtr(),
22 GoogleServiceAuthError(GoogleServiceAuthError::NONE),
23 "access_token",
24 base::Time::Max()));
25 }
26
BuildTokenService(content::BrowserContext * context)27 BrowserContextKeyedService* FakeOAuth2TokenService::BuildTokenService(
28 content::BrowserContext* context) {
29 Profile* profile = static_cast<Profile*>(context);
30
31 FakeOAuth2TokenService* service = new FakeOAuth2TokenService();
32 service->Initialize(profile);
33 return service;
34 }
35
PersistCredentials(const std::string & account_id,const std::string & refresh_token)36 void FakeOAuth2TokenService::PersistCredentials(
37 const std::string& account_id,
38 const std::string& refresh_token) {
39 // Disabling the token persistence.
40 }
41
ClearPersistedCredentials(const std::string & account_id)42 void FakeOAuth2TokenService::ClearPersistedCredentials(
43 const std::string& account_id) {
44 // Disabling the token persistence.
45 }
46