Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / sync / profile_sync_service_mock.cc
blob8d6202fa8a157224a305de376d0376d4c86df3c3
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.h"
8 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
9 #include "chrome/browser/signin/signin_manager_factory.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"
15 ProfileSyncServiceMock::ProfileSyncServiceMock(Profile* profile)
16 : ProfileSyncService(
17 NULL,
18 profile,
19 NULL,
20 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
21 ProfileSyncService::MANUAL_START) {}
23 ProfileSyncServiceMock::~ProfileSyncServiceMock() {
26 // static
27 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() {
28 TestingProfile* profile = new TestingProfile();
29 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo");
30 return profile;
33 // static
34 BrowserContextKeyedService* ProfileSyncServiceMock::BuildMockProfileSyncService(
35 content::BrowserContext* profile) {
36 return new ProfileSyncServiceMock(static_cast<Profile*>(profile));
39 ScopedVector<browser_sync::DeviceInfo>
40 ProfileSyncServiceMock::GetAllSignedInDevices() const {
41 ScopedVector<browser_sync::DeviceInfo> devices;
42 std::vector<browser_sync::DeviceInfo*>* device_vector =
43 GetAllSignedInDevicesMock();
44 devices.get() = *device_vector;
45 return devices.Pass();
48 scoped_ptr<browser_sync::DeviceInfo>
49 ProfileSyncServiceMock::GetLocalDeviceInfo() const {
50 return scoped_ptr<browser_sync::DeviceInfo>(GetLocalDeviceInfoMock()).Pass();