OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_mock_builder.h" |
| 6 #include "chrome/browser/prefs/testing_pref_store.h" |
5 #include "chrome/browser/sync/profile_sync_service_mock.h" | 7 #include "chrome/browser/sync/profile_sync_service_mock.h" |
6 #include "chrome/browser/sync/signin_manager.h" | 8 #include "chrome/browser/sync/signin_manager.h" |
7 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 9 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 10 #include "chrome/common/pref_names.h" |
8 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/test/base/testing_profile.h" |
9 | 13 |
10 ProfileSyncServiceMock::ProfileSyncServiceMock() | 14 ProfileSyncServiceMock::ProfileSyncServiceMock() |
11 : ProfileSyncService(NULL, NULL, new SigninManager(), "") { | 15 : ProfileSyncService(NULL, NULL, new SigninManager(), "") { |
12 } | 16 } |
13 | 17 |
| 18 ProfileSyncServiceMock::ProfileSyncServiceMock( |
| 19 Profile* profile) : ProfileSyncService(NULL, profile, NULL, "") { |
| 20 } |
| 21 |
14 ProfileSyncServiceMock::~ProfileSyncServiceMock() { | 22 ProfileSyncServiceMock::~ProfileSyncServiceMock() { |
15 } | 23 } |
| 24 |
| 25 // static |
| 26 Profile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { |
| 27 TestingProfile* profile = new TestingProfile(); |
| 28 TestingPrefStore* user_prefs = new TestingPrefStore(); |
| 29 PrefService* prefs = PrefServiceMockBuilder() |
| 30 .WithUserPrefs(user_prefs) |
| 31 .Create(); |
| 32 profile->SetPrefService(prefs); |
| 33 SigninManager::RegisterUserPrefs(prefs); |
| 34 user_prefs->SetString(prefs::kGoogleServicesUsername, "foo"); |
| 35 return profile; |
| 36 } |
OLD | NEW |