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

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

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: Fixed mac tests Created 7 years, 1 month 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"
(...skipping 12 matching lines...) Expand all
23 23
24 #if defined(ENABLE_CONFIGURATION_POLICY) 24 #if defined(ENABLE_CONFIGURATION_POLICY)
25 #include "chrome/browser/policy/browser_policy_connector.h" 25 #include "chrome/browser/policy/browser_policy_connector.h"
26 #include "chrome/browser/policy/mock_configuration_policy_provider.h" 26 #include "chrome/browser/policy/mock_configuration_policy_provider.h"
27 #include "chrome/browser/policy/policy_map.h" 27 #include "chrome/browser/policy/policy_map.h"
28 #include "policy/policy_constants.h" 28 #include "policy/policy_constants.h"
29 #endif 29 #endif
30 30
31 namespace { 31 namespace {
32 32
33 using testing::AnyNumber; 33 using testing::AnyNumber;
bartfab (slow) 2013/11/05 15:53:04 Nit: No longer used.
Joao da Silva 2013/11/07 13:15:00 Done.
34 using testing::Return; 34 using testing::Return;
35 using testing::_; 35 using testing::_;
36 36
37 class TestSyncProcessorStub : public syncer::SyncChangeProcessor { 37 class TestSyncProcessorStub : public syncer::SyncChangeProcessor {
38 virtual syncer::SyncError ProcessSyncChanges( 38 virtual syncer::SyncError ProcessSyncChanges(
39 const tracked_objects::Location& from_here, 39 const tracked_objects::Location& from_here,
40 const syncer::SyncChangeList& change_list) OVERRIDE { 40 const syncer::SyncChangeList& change_list) OVERRIDE {
41 return syncer::SyncError(); 41 return syncer::SyncError();
42 } 42 }
43 43
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 SyncedPrefChangeRegistrar* registrar() const { 98 SyncedPrefChangeRegistrar* registrar() const {
99 return registrar_.get(); 99 return registrar_.get();
100 } 100 }
101 101
102 private: 102 private:
103 #if defined(ENABLE_CONFIGURATION_POLICY) 103 #if defined(ENABLE_CONFIGURATION_POLICY)
104 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 104 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
105 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) 105 EXPECT_CALL(policy_provider_, IsInitializationComplete(_))
106 .WillRepeatedly(Return(true)); 106 .WillRepeatedly(Return(true));
107 EXPECT_CALL(policy_provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
108 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( 107 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(
109 &policy_provider_); 108 &policy_provider_);
110 } 109 }
111 #endif 110 #endif
112 111
113 virtual void SetUpOnMainThread() OVERRIDE { 112 virtual void SetUpOnMainThread() OVERRIDE {
114 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); 113 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile());
115 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); 114 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES);
116 syncer_->MergeDataAndStartSyncing( 115 syncer_->MergeDataAndStartSyncing(
117 syncer::PREFERENCES, 116 syncer::PREFERENCES,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 base::Value::CreateBooleanValue(true), 222 base::Value::CreateBooleanValue(true),
224 NULL); 223 NULL);
225 UpdateChromePolicy(policies); 224 UpdateChromePolicy(policies);
226 225
227 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); 226 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton));
228 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); 227 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false);
229 EXPECT_FALSE(observer.has_been_notified); 228 EXPECT_FALSE(observer.has_been_notified);
230 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); 229 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton));
231 } 230 }
232 #endif 231 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698