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.
4
5#include "chrome/browser/profiles/profile.h"
6#include "chrome/browser/signin/chrome_signin_client_factory.h"
7#include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
8#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
9
10// TODO(blundell): Should these be namespaced?
11KeyedService* BuildFakeProfileOAuth2TokenService(
12    content::BrowserContext* context) {
13  Profile* profile = Profile::FromBrowserContext(context);
14  FakeProfileOAuth2TokenService* service = new FakeProfileOAuth2TokenService();
15  service->Initialize(
16      ChromeSigninClientFactory::GetInstance()->GetForProfile(profile));
17  return service;
18}
19
20KeyedService* BuildAutoIssuingFakeProfileOAuth2TokenService(
21    content::BrowserContext* context) {
22  Profile* profile = Profile::FromBrowserContext(context);
23  FakeProfileOAuth2TokenService* service = new FakeProfileOAuth2TokenService();
24  service->set_auto_post_fetch_response_on_message_loop(true);
25  service->Initialize(
26      ChromeSigninClientFactory::GetInstance()->GetForProfile(profile));
27  return service;
28}
29