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.
5 #include "ios/chrome/browser/signin/fake_oauth2_token_service_builder.h"
7 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
8 #include "components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.h"
9 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
10 #include "ios/chrome/browser/signin/signin_client_factory.h"
11 #include "ios/chrome/browser/signin/signin_error_controller_factory.h"
12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
13 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
15 scoped_ptr
<KeyedService
> BuildFakeOAuth2TokenService(
16 web::BrowserState
* context
) {
17 ios::ChromeBrowserState
* browser_state
=
18 ios::ChromeBrowserState::FromBrowserState(context
);
19 OAuth2TokenServiceDelegate
* delegate
=
20 new FakeProfileOAuth2TokenServiceIOSDelegate(
21 SigninClientFactory::GetForBrowserState(browser_state
),
22 ios::GetChromeBrowserProvider()
23 ->GetProfileOAuth2TokenServiceIOSProvider(),
24 ios::AccountTrackerServiceFactory::GetForBrowserState(browser_state
),
25 ios::SigninErrorControllerFactory::GetForBrowserState(browser_state
));
26 return make_scoped_ptr(new FakeProfileOAuth2TokenService(delegate
));