Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / signin / fake_signin_manager_builder.cc
blobe206cdf4a7f50a7b20662606c4f6841edfdca4b6
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_signin_manager_builder.h"
7 #include "components/signin/core/browser/fake_signin_manager.h"
8 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
9 #include "ios/chrome/browser/signin/gaia_cookie_manager_service_factory.h"
10 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
11 #include "ios/chrome/browser/signin/signin_client_factory.h"
12 #include "ios/chrome/browser/signin/signin_manager_factory.h"
13 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
15 namespace ios {
17 scoped_ptr<KeyedService> BuildFakeSigninManager(
18 web::BrowserState* browser_state) {
19 ios::ChromeBrowserState* chrome_browser_state =
20 ios::ChromeBrowserState::FromBrowserState(browser_state);
21 scoped_ptr<SigninManager> manager(new FakeSigninManager(
22 SigninClientFactory::GetForBrowserState(chrome_browser_state),
23 OAuth2TokenServiceFactory::GetForBrowserState(chrome_browser_state),
24 ios::AccountTrackerServiceFactory::GetForBrowserState(
25 chrome_browser_state),
26 ios::GaiaCookieManagerServiceFactory::GetForBrowserState(
27 chrome_browser_state)));
28 manager->Initialize(nullptr);
29 ios::SigninManagerFactory::GetInstance()
30 ->NotifyObserversOfSigninManagerCreationForTesting(manager.get());
31 return manager.Pass();
34 } // namespace ios