Index: chrome/browser/sync/profile_sync_service_mock.cc |
=================================================================== |
--- chrome/browser/sync/profile_sync_service_mock.cc (revision 150390) |
+++ chrome/browser/sync/profile_sync_service_mock.cc (working copy) |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/prefs/pref_service.h" |
+#include "chrome/browser/prefs/pref_service_mock_builder.h" |
#include "chrome/browser/prefs/testing_pref_store.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/sync/profile_sync_service_mock.h" |
@@ -31,7 +31,14 @@ |
// static |
TestingProfile* ProfileSyncServiceMock::MakeSignedInTestingProfile() { |
TestingProfile* profile = new TestingProfile(); |
- profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo"); |
+ TestingPrefStore* user_prefs = new TestingPrefStore(); |
+ PrefService* prefs = PrefServiceMockBuilder() |
+ .WithUserPrefs(user_prefs) |
+ .Create(); |
+ profile->SetPrefService(prefs); |
+ // We just blew away our prefs, so reregister them. |
+ SigninManagerFactory::GetInstance()->RegisterUserPrefs(prefs); |
+ user_prefs->SetString(prefs::kGoogleServicesUsername, "foo"); |
return profile; |
} |