OLD | NEW |
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, | 185 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, |
186 IgnoreLocalChangesToManagedPrefs) { | 186 IgnoreLocalChangesToManagedPrefs) { |
187 TestSyncedPrefObserver observer = {}; | 187 TestSyncedPrefObserver observer = {}; |
188 registrar()->Add(prefs::kShowHomeButton, | 188 registrar()->Add(prefs::kShowHomeButton, |
189 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); | 189 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); |
190 | 190 |
191 policy::PolicyMap policies; | 191 policy::PolicyMap policies; |
192 policies.Set(policy::key::kShowHomeButton, | 192 policies.Set(policy::key::kShowHomeButton, |
193 policy::POLICY_LEVEL_MANDATORY, | 193 policy::POLICY_LEVEL_MANDATORY, |
194 policy::POLICY_SCOPE_USER, | 194 policy::POLICY_SCOPE_USER, |
195 base::Value::CreateBooleanValue(true), | 195 new base::FundamentalValue(true), |
196 NULL); | 196 NULL); |
197 UpdateChromePolicy(policies); | 197 UpdateChromePolicy(policies); |
198 | 198 |
199 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 199 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
200 | 200 |
201 SetBooleanPrefValueFromLocal(prefs::kShowHomeButton, false); | 201 SetBooleanPrefValueFromLocal(prefs::kShowHomeButton, false); |
202 EXPECT_FALSE(observer.has_been_notified); | 202 EXPECT_FALSE(observer.has_been_notified); |
203 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 203 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
204 } | 204 } |
205 | 205 |
206 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, | 206 IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, |
207 IgnoreSyncChangesToManagedPrefs) { | 207 IgnoreSyncChangesToManagedPrefs) { |
208 TestSyncedPrefObserver observer = {}; | 208 TestSyncedPrefObserver observer = {}; |
209 registrar()->Add(prefs::kShowHomeButton, | 209 registrar()->Add(prefs::kShowHomeButton, |
210 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); | 210 base::Bind(&TestPrefChangeCallback, prefs(), &observer)); |
211 | 211 |
212 policy::PolicyMap policies; | 212 policy::PolicyMap policies; |
213 policies.Set(policy::key::kShowHomeButton, | 213 policies.Set(policy::key::kShowHomeButton, |
214 policy::POLICY_LEVEL_MANDATORY, | 214 policy::POLICY_LEVEL_MANDATORY, |
215 policy::POLICY_SCOPE_USER, | 215 policy::POLICY_SCOPE_USER, |
216 base::Value::CreateBooleanValue(true), | 216 new base::FundamentalValue(true), |
217 NULL); | 217 NULL); |
218 UpdateChromePolicy(policies); | 218 UpdateChromePolicy(policies); |
219 | 219 |
220 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 220 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
221 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); | 221 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); |
222 EXPECT_FALSE(observer.has_been_notified); | 222 EXPECT_FALSE(observer.has_been_notified); |
223 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 223 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
224 } | 224 } |
225 #endif | 225 #endif |
OLD | NEW |