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

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

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
(...skipping 11 matching lines...) Expand all
22 #include "sync/api/sync_error_factory.h" 22 #include "sync/api/sync_error_factory.h"
23 #include "sync/api/sync_error_factory_mock.h" 23 #include "sync/api/sync_error_factory_mock.h"
24 #include "sync/api/syncable_service.h" 24 #include "sync/api/syncable_service.h"
25 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test .h" 25 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test .h"
26 #include "sync/protocol/sync.pb.h" 26 #include "sync/protocol/sync.pb.h"
27 27
28 #if defined(ENABLE_CONFIGURATION_POLICY) 28 #if defined(ENABLE_CONFIGURATION_POLICY)
29 #include "components/policy/core/browser/browser_policy_connector.h" 29 #include "components/policy/core/browser/browser_policy_connector.h"
30 #include "components/policy/core/common/mock_configuration_policy_provider.h" 30 #include "components/policy/core/common/mock_configuration_policy_provider.h"
31 #include "components/policy/core/common/policy_map.h" 31 #include "components/policy/core/common/policy_map.h"
32 #include "components/policy/core/common/policy_types.h"
33 #include "policy/policy_constants.h" 32 #include "policy/policy_constants.h"
34 #endif 33 #endif
35 34
36 namespace { 35 namespace {
37 36
38 using testing::Return; 37 using testing::Return;
39 using testing::_; 38 using testing::_;
40 39
41 class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { 40 class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest {
42 public: 41 public:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, 184 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest,
186 IgnoreLocalChangesToManagedPrefs) { 185 IgnoreLocalChangesToManagedPrefs) {
187 TestSyncedPrefObserver observer = {}; 186 TestSyncedPrefObserver observer = {};
188 registrar()->Add(prefs::kShowHomeButton, 187 registrar()->Add(prefs::kShowHomeButton,
189 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); 188 base::Bind(&TestPrefChangeCallback, prefs(), &observer));
190 189
191 policy::PolicyMap policies; 190 policy::PolicyMap policies;
192 policies.Set(policy::key::kShowHomeButton, 191 policies.Set(policy::key::kShowHomeButton,
193 policy::POLICY_LEVEL_MANDATORY, 192 policy::POLICY_LEVEL_MANDATORY,
194 policy::POLICY_SCOPE_USER, 193 policy::POLICY_SCOPE_USER,
195 policy::POLICY_SOURCE_CLOUD,
196 new base::FundamentalValue(true), 194 new base::FundamentalValue(true),
197 NULL); 195 NULL);
198 UpdateChromePolicy(policies); 196 UpdateChromePolicy(policies);
199 197
200 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); 198 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton));
201 199
202 SetBooleanPrefValueFromLocal(prefs::kShowHomeButton, false); 200 SetBooleanPrefValueFromLocal(prefs::kShowHomeButton, false);
203 EXPECT_FALSE(observer.has_been_notified); 201 EXPECT_FALSE(observer.has_been_notified);
204 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); 202 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton));
205 } 203 }
206 204
207 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, 205 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest,
208 IgnoreSyncChangesToManagedPrefs) { 206 IgnoreSyncChangesToManagedPrefs) {
209 TestSyncedPrefObserver observer = {}; 207 TestSyncedPrefObserver observer = {};
210 registrar()->Add(prefs::kShowHomeButton, 208 registrar()->Add(prefs::kShowHomeButton,
211 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); 209 base::Bind(&TestPrefChangeCallback, prefs(), &observer));
212 210
213 policy::PolicyMap policies; 211 policy::PolicyMap policies;
214 policies.Set(policy::key::kShowHomeButton, 212 policies.Set(policy::key::kShowHomeButton,
215 policy::POLICY_LEVEL_MANDATORY, 213 policy::POLICY_LEVEL_MANDATORY,
216 policy::POLICY_SCOPE_USER, 214 policy::POLICY_SCOPE_USER,
217 policy::POLICY_SOURCE_CLOUD,
218 new base::FundamentalValue(true), 215 new base::FundamentalValue(true),
219 NULL); 216 NULL);
220 UpdateChromePolicy(policies); 217 UpdateChromePolicy(policies);
221 218
222 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); 219 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton));
223 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); 220 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false);
224 EXPECT_FALSE(observer.has_been_notified); 221 EXPECT_FALSE(observer.has_been_notified);
225 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); 222 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton));
226 } 223 }
227 #endif 224 #endif
OLDNEW
« no previous file with comments | « chrome/browser/prefs/proxy_policy_unittest.cc ('k') | chrome/browser/profiles/incognito_mode_policy_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698