MD Downloads: UI review feedback
[chromium-blink-merge.git] / chrome / browser / signin / fake_signin_manager_builder.cc
blob887dade08fcb6559d75e125610163186d58e5fda
1 // Copyright (c) 2012 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 "chrome/browser/signin/fake_signin_manager_builder.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/account_tracker_service_factory.h"
9 #include "chrome/browser/signin/chrome_signin_client_factory.h"
10 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/signin/signin_manager_factory.h"
14 scoped_ptr<KeyedService> BuildFakeSigninManagerBase(
15 content::BrowserContext* context) {
16 scoped_ptr<SigninManagerBase> manager;
17 Profile* profile = static_cast<Profile*>(context);
18 manager.reset(new FakeSigninManagerForTesting(profile));
19 manager->Initialize(nullptr);
20 SigninManagerFactory::GetInstance()
21 ->NotifyObserversOfSigninManagerCreationForTesting(manager.get());
22 return manager.Pass();
25 #if defined(OS_CHROMEOS)
26 FakeSigninManagerForTesting::FakeSigninManagerForTesting(Profile* profile)
27 : FakeSigninManagerBase(
28 ChromeSigninClientFactory::GetForProfile(profile),
29 AccountTrackerServiceFactory::GetForProfile(profile)) {}
30 #else
31 FakeSigninManagerForTesting::FakeSigninManagerForTesting(Profile* profile)
32 : FakeSigninManager(
33 ChromeSigninClientFactory::GetForProfile(profile),
34 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
35 AccountTrackerServiceFactory::GetForProfile(profile),
36 GaiaCookieManagerServiceFactory::GetForProfile(profile)) {}
37 #endif