EME test page application.
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_service_mock.cc
blob5cec275438ebac5ff6bed8b2ab9755783dd563c5
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 "base/prefs/pref_service.h"
6 #include "base/prefs/testing_pref_store.h"
7 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
8 #include "chrome/browser/signin/signin_manager_factory.h"
9 #include "chrome/browser/sync/managed_user_signin_manager_wrapper.h"
10 #include "chrome/browser/sync/profile_sync_service_mock.h"
11 #include "chrome/common/pref_names.h"
12 #include "chrome/common/url_constants.h"
13 #include "chrome/test/base/testing_profile.h"
14 #include "components/signin/core/browser/profile_oauth2_token_service.h"
15 #include "components/signin/core/browser/signin_manager.h"
17 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile)
18 : ProfileSyncService(
19 NULL,
20 profile,
21 new ManagedUserSigninManagerWrapper(
22 profile,
23 SigninManagerFactory::GetForProfile(profile)),
24 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
25 browser_sync::MANUAL_START) {}
27 ProfileSyncServiceMock::~ProfileSyncServiceMock() {
30 // static
31 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() {
32 TestingProfile* profile = new TestingProfile();
33 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo");
34 return profile;
37 // static
38 KeyedService* ProfileSyncServiceMock::BuildMockProfileSyncService(
39 content::BrowserContext* profile) {
40 return new ProfileSyncServiceMock(static_cast<Profile*>(profile));
43 ScopedVector<browser_sync::DeviceInfo>
44 ProfileSyncServiceMock::GetAllSignedInDevices() const {
45 ScopedVector<browser_sync::DeviceInfo> devices;
46 std::vector<browser_sync::DeviceInfo*>* device_vector =
47 GetAllSignedInDevicesMock();
48 devices.get() = *device_vector;
49 return devices.Pass();
52 scoped_ptr<browser_sync::DeviceInfo>
53 ProfileSyncServiceMock::GetLocalDeviceInfo() const {
54 return scoped_ptr<browser_sync::DeviceInfo>(GetLocalDeviceInfoMock()).Pass();