Home | History | Annotate | Download | only in sync
      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.
      4 
      5 #include "base/prefs/pref_service.h"
      6 #include "base/prefs/testing_pref_store.h"
      7 #include "chrome/browser/signin/signin_manager_factory.h"
      8 #include "chrome/browser/sync/profile_sync_service_mock.h"
      9 #include "chrome/common/pref_names.h"
     10 #include "chrome/common/url_constants.h"
     11 #include "chrome/test/base/testing_profile.h"
     12 
     13 ProfileSyncServiceMock::ProfileSyncServiceMock()
     14     : ProfileSyncService(NULL,
     15                          NULL,
     16                          NULL,
     17                          ProfileSyncService::MANUAL_START) {
     18 }
     19 
     20 ProfileSyncServiceMock::ProfileSyncServiceMock(
     21     Profile* profile) : ProfileSyncService(NULL,
     22                                            profile,
     23                                            NULL,
     24                                            ProfileSyncService::MANUAL_START) {
     25 }
     26 
     27 ProfileSyncServiceMock::~ProfileSyncServiceMock() {
     28 }
     29 
     30 // static
     31 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() {
     32   TestingProfile* profile = new TestingProfile();
     33   profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo");
     34   return profile;
     35 }
     36 
     37 // static
     38 BrowserContextKeyedService* ProfileSyncServiceMock::BuildMockProfileSyncService(
     39     content::BrowserContext* profile) {
     40   return new ProfileSyncServiceMock(static_cast<Profile*>(profile));
     41 }
     42 
     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();
     50 }
     51 
     52