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/sync/profile_sync_service_mock.h"
7 #include "base/prefs/pref_service.h"
8 #include "base/prefs/testing_pref_store.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
12 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
13 #include "chrome/common/pref_names.h"
14 #include "chrome/common/url_constants.h"
15 #include "chrome/test/base/testing_profile.h"
16 #include "components/signin/core/browser/profile_oauth2_token_service.h"
17 #include "components/signin/core/browser/signin_manager.h"
19 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile
* profile
)
21 scoped_ptr
<ProfileSyncComponentsFactory
>(
22 new ProfileSyncComponentsFactoryMock()),
24 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(
26 SigninManagerFactory::GetForProfile(profile
))),
27 ProfileOAuth2TokenServiceFactory::GetForProfile(profile
),
28 browser_sync::MANUAL_START
) {
31 ProfileSyncServiceMock::ProfileSyncServiceMock(
32 scoped_ptr
<ProfileSyncComponentsFactory
> factory
, Profile
* profile
)
36 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(
38 SigninManagerFactory::GetForProfile(profile
))),
39 ProfileOAuth2TokenServiceFactory::GetForProfile(profile
),
40 browser_sync::MANUAL_START
) {
43 ProfileSyncServiceMock::~ProfileSyncServiceMock() {
47 TestingProfile
* ProfileSyncServiceMock::MakeSignedInTestingProfile() {
48 TestingProfile
* profile
= new TestingProfile();
49 SigninManagerFactory::GetForProfile(profile
)->
50 SetAuthenticatedUsername("foo");
55 KeyedService
* ProfileSyncServiceMock::BuildMockProfileSyncService(
56 content::BrowserContext
* profile
) {
57 return new ProfileSyncServiceMock(static_cast<Profile
*>(profile
));