Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Fixing ChromeOS and Linux compilation Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/prefs/pref_service_syncable_util.h"
11 #include "chrome/browser/prefs/synced_pref_change_registrar.h" 12 #include "chrome/browser/prefs/synced_pref_change_registrar.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/testing_pref_service_syncable.h" 16 #include "chrome/test/base/testing_pref_service_syncable.h"
16 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
18 #include "sync/api/attachments/attachment_id.h" 19 #include "sync/api/attachments/attachment_id.h"
19 #include "sync/api/fake_sync_change_processor.h" 20 #include "sync/api/fake_sync_change_processor.h"
20 #include "sync/api/sync_change.h" 21 #include "sync/api/sync_change.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #if defined(ENABLE_CONFIGURATION_POLICY) 97 #if defined(ENABLE_CONFIGURATION_POLICY)
97 void SetUpInProcessBrowserTestFixture() override { 98 void SetUpInProcessBrowserTestFixture() override {
98 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) 99 EXPECT_CALL(policy_provider_, IsInitializationComplete(_))
99 .WillRepeatedly(Return(true)); 100 .WillRepeatedly(Return(true));
100 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( 101 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(
101 &policy_provider_); 102 &policy_provider_);
102 } 103 }
103 #endif 104 #endif
104 105
105 void SetUpOnMainThread() override { 106 void SetUpOnMainThread() override {
106 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); 107 prefs_ = PrefServiceSyncableFromProfile(browser()->profile());
107 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); 108 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES);
108 syncer_->MergeDataAndStartSyncing( 109 syncer_->MergeDataAndStartSyncing(
109 syncer::PREFERENCES, 110 syncer::PREFERENCES,
110 syncer::SyncDataList(), 111 syncer::SyncDataList(),
111 scoped_ptr<syncer::SyncChangeProcessor>( 112 scoped_ptr<syncer::SyncChangeProcessor>(
112 new syncer::FakeSyncChangeProcessor), 113 new syncer::FakeSyncChangeProcessor),
113 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock)); 114 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock));
114 registrar_.reset(new SyncedPrefChangeRegistrar(prefs_)); 115 registrar_.reset(new SyncedPrefChangeRegistrar(prefs_));
115 } 116 }
116 117
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 new base::FundamentalValue(true), 215 new base::FundamentalValue(true),
215 NULL); 216 NULL);
216 UpdateChromePolicy(policies); 217 UpdateChromePolicy(policies);
217 218
218 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); 219 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton));
219 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); 220 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false);
220 EXPECT_FALSE(observer.has_been_notified); 221 EXPECT_FALSE(observer.has_been_notified);
221 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); 222 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton));
222 } 223 }
223 #endif 224 #endif
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_syncable_util.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698