Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/prefs/pref_service.h" | |
| 5 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 6 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
|
Mattias Nissler (ping if slow)
2012/08/03 12:19:08
not needed any longer?
Andrew T Wilson (Slow)
2012/08/04 00:54:41
Done.
| |
| 6 #include "chrome/browser/prefs/testing_pref_store.h" | 7 #include "chrome/browser/prefs/testing_pref_store.h" |
| 7 #include "chrome/browser/signin/signin_manager_factory.h" | 8 #include "chrome/browser/signin/signin_manager_factory.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_mock.h" | 9 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 9 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 10 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 13 | 14 |
| 14 ProfileSyncServiceMock::ProfileSyncServiceMock() | 15 ProfileSyncServiceMock::ProfileSyncServiceMock() |
| 15 : ProfileSyncService(NULL, | 16 : ProfileSyncService(NULL, |
| 16 NULL, | 17 NULL, |
| 17 NULL, | 18 NULL, |
| 18 ProfileSyncService::MANUAL_START) { | 19 ProfileSyncService::MANUAL_START) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 ProfileSyncServiceMock::ProfileSyncServiceMock( | 22 ProfileSyncServiceMock::ProfileSyncServiceMock( |
| 22 Profile* profile) : ProfileSyncService(NULL, | 23 Profile* profile) : ProfileSyncService(NULL, |
| 23 profile, | 24 profile, |
| 24 NULL, | 25 NULL, |
| 25 ProfileSyncService::MANUAL_START) { | 26 ProfileSyncService::MANUAL_START) { |
| 26 } | 27 } |
| 27 | 28 |
| 28 ProfileSyncServiceMock::~ProfileSyncServiceMock() { | 29 ProfileSyncServiceMock::~ProfileSyncServiceMock() { |
| 29 } | 30 } |
| 30 | 31 |
| 31 // static | 32 // static |
| 32 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { | 33 TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { |
| 33 TestingProfile* profile = new TestingProfile(); | 34 TestingProfile* profile = new TestingProfile(); |
| 34 TestingPrefStore* user_prefs = new TestingPrefStore(); | 35 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo"); |
| 35 PrefService* prefs = PrefServiceMockBuilder() | |
| 36 .WithUserPrefs(user_prefs) | |
| 37 .Create(); | |
| 38 profile->SetPrefService(prefs); | |
| 39 // We just blew away our prefs, so reregister them. | |
| 40 SigninManagerFactory::GetInstance()->RegisterUserPrefs(prefs); | |
| 41 user_prefs->SetString(prefs::kGoogleServicesUsername, "foo"); | |
| 42 return profile; | 36 return profile; |
| 43 } | 37 } |
| 44 | 38 |
| 45 // static | 39 // static |
| 46 ProfileKeyedService* ProfileSyncServiceMock::BuildMockProfileSyncService( | 40 ProfileKeyedService* ProfileSyncServiceMock::BuildMockProfileSyncService( |
| 47 Profile* profile) { | 41 Profile* profile) { |
| 48 return new ProfileSyncServiceMock(profile); | 42 return new ProfileSyncServiceMock(profile); |
| 49 } | 43 } |
| OLD | NEW |