1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_notifier.h"
11 #include "base/prefs/pref_value_store.h"
12 #include "base/prefs/testing_pref_store.h"
13 #include "base/values.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h"
22 // Allows to capture pref notifications through gmock.
23 class MockPrefNotifier
: public PrefNotifier
{
25 MOCK_METHOD1(OnPreferenceChanged
, void(const std::string
&));
26 MOCK_METHOD1(OnInitializationCompleted
, void(bool));
29 // Allows to capture sync model associator interaction.
30 class MockPrefModelAssociator
{
32 MOCK_METHOD1(ProcessPrefChange
, void(const std::string
&));
37 // Names of the preferences used in this test.
39 const char kManagedPref
[] = "this.pref.managed";
40 const char kCommandLinePref
[] = "this.pref.command_line";
41 const char kExtensionPref
[] = "this.pref.extension";
42 const char kUserPref
[] = "this.pref.user";
43 const char kRecommendedPref
[] = "this.pref.recommended";
44 const char kDefaultPref
[] = "this.pref.default";
45 const char kMissingPref
[] = "this.pref.does_not_exist";
48 // Potentially expected values of all preferences used in this test program.
49 namespace managed_pref
{
50 const char kManagedValue
[] = "managed:managed";
53 namespace extension_pref
{
54 const char kManagedValue
[] = "extension:managed";
55 const char kExtensionValue
[] = "extension:extension";
58 namespace command_line_pref
{
59 const char kManagedValue
[] = "command_line:managed";
60 const char kExtensionValue
[] = "command_line:extension";
61 const char kCommandLineValue
[] = "command_line:command_line";
65 const char kManagedValue
[] = "user:managed";
66 const char kExtensionValue
[] = "user:extension";
67 const char kCommandLineValue
[] = "user:command_line";
68 const char kUserValue
[] = "user:user";
71 namespace recommended_pref
{
72 const char kManagedValue
[] = "recommended:managed";
73 const char kExtensionValue
[] = "recommended:extension";
74 const char kCommandLineValue
[] = "recommended:command_line";
75 const char kUserValue
[] = "recommended:user";
76 const char kRecommendedValue
[] = "recommended:recommended";
79 namespace default_pref
{
80 const char kManagedValue
[] = "default:managed";
81 const char kExtensionValue
[] = "default:extension";
82 const char kCommandLineValue
[] = "default:command_line";
83 const char kUserValue
[] = "default:user";
84 const char kRecommendedValue
[] = "default:recommended";
85 const char kDefaultValue
[] = "default:default";
88 class PrefValueStoreTest
: public testing::Test
{
90 virtual void SetUp() {
91 // Create TestingPrefStores.
93 CreateExtensionPrefs();
94 CreateCommandLinePrefs();
96 CreateRecommendedPrefs();
98 sync_associator_
.reset(new MockPrefModelAssociator());
100 // Create a fresh PrefValueStore.
101 pref_value_store_
.reset(new PrefValueStore(managed_pref_store_
.get(),
102 extension_pref_store_
.get(),
103 command_line_pref_store_
.get(),
104 user_pref_store_
.get(),
105 recommended_pref_store_
.get(),
106 default_pref_store_
.get(),
109 pref_value_store_
->set_callback(
110 base::Bind(&MockPrefModelAssociator::ProcessPrefChange
,
111 base::Unretained(sync_associator_
.get())));
114 void CreateManagedPrefs() {
115 managed_pref_store_
= new TestingPrefStore
;
116 managed_pref_store_
->SetString(
118 managed_pref::kManagedValue
);
121 void CreateExtensionPrefs() {
122 extension_pref_store_
= new TestingPrefStore
;
123 extension_pref_store_
->SetString(
125 extension_pref::kManagedValue
);
126 extension_pref_store_
->SetString(
127 prefs::kExtensionPref
,
128 extension_pref::kExtensionValue
);
131 void CreateCommandLinePrefs() {
132 command_line_pref_store_
= new TestingPrefStore
;
133 command_line_pref_store_
->SetString(
135 command_line_pref::kManagedValue
);
136 command_line_pref_store_
->SetString(
137 prefs::kExtensionPref
,
138 command_line_pref::kExtensionValue
);
139 command_line_pref_store_
->SetString(
140 prefs::kCommandLinePref
,
141 command_line_pref::kCommandLineValue
);
144 void CreateUserPrefs() {
145 user_pref_store_
= new TestingPrefStore
;
146 user_pref_store_
->SetString(
148 user_pref::kManagedValue
);
149 user_pref_store_
->SetString(
150 prefs::kCommandLinePref
,
151 user_pref::kCommandLineValue
);
152 user_pref_store_
->SetString(
153 prefs::kExtensionPref
,
154 user_pref::kExtensionValue
);
155 user_pref_store_
->SetString(
157 user_pref::kUserValue
);
160 void CreateRecommendedPrefs() {
161 recommended_pref_store_
= new TestingPrefStore
;
162 recommended_pref_store_
->SetString(
164 recommended_pref::kManagedValue
);
165 recommended_pref_store_
->SetString(
166 prefs::kCommandLinePref
,
167 recommended_pref::kCommandLineValue
);
168 recommended_pref_store_
->SetString(
169 prefs::kExtensionPref
,
170 recommended_pref::kExtensionValue
);
171 recommended_pref_store_
->SetString(
173 recommended_pref::kUserValue
);
174 recommended_pref_store_
->SetString(
175 prefs::kRecommendedPref
,
176 recommended_pref::kRecommendedValue
);
179 void CreateDefaultPrefs() {
180 default_pref_store_
= new TestingPrefStore
;
181 default_pref_store_
->SetString(
183 default_pref::kManagedValue
);
184 default_pref_store_
->SetString(
185 prefs::kCommandLinePref
,
186 default_pref::kCommandLineValue
);
187 default_pref_store_
->SetString(
188 prefs::kExtensionPref
,
189 default_pref::kExtensionValue
);
190 default_pref_store_
->SetString(
192 default_pref::kUserValue
);
193 default_pref_store_
->SetString(
194 prefs::kRecommendedPref
,
195 default_pref::kRecommendedValue
);
196 default_pref_store_
->SetString(
198 default_pref::kDefaultValue
);
201 void ExpectValueChangeNotifications(const char* name
) {
202 EXPECT_CALL(pref_notifier_
, OnPreferenceChanged(name
));
203 EXPECT_CALL(*sync_associator_
, ProcessPrefChange(name
));
206 void CheckAndClearValueChangeNotifications() {
207 Mock::VerifyAndClearExpectations(&pref_notifier_
);
208 Mock::VerifyAndClearExpectations(sync_associator_
.get());
211 MockPrefNotifier pref_notifier_
;
212 scoped_ptr
<MockPrefModelAssociator
> sync_associator_
;
213 scoped_ptr
<PrefValueStore
> pref_value_store_
;
215 scoped_refptr
<TestingPrefStore
> managed_pref_store_
;
216 scoped_refptr
<TestingPrefStore
> extension_pref_store_
;
217 scoped_refptr
<TestingPrefStore
> command_line_pref_store_
;
218 scoped_refptr
<TestingPrefStore
> user_pref_store_
;
219 scoped_refptr
<TestingPrefStore
> recommended_pref_store_
;
220 scoped_refptr
<TestingPrefStore
> default_pref_store_
;
223 TEST_F(PrefValueStoreTest
, GetValue
) {
224 const base::Value
* value
;
226 // The following tests read a value from the PrefService. The preferences are
227 // set in a way such that all lower-priority stores have a value and we can
228 // test whether overrides work correctly.
230 // Test getting a managed value.
232 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kManagedPref
,
233 base::Value::TYPE_STRING
, &value
));
234 std::string actual_str_value
;
235 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
236 EXPECT_EQ(managed_pref::kManagedValue
, actual_str_value
);
238 // Test getting an extension value.
240 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kExtensionPref
,
241 base::Value::TYPE_STRING
, &value
));
242 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
243 EXPECT_EQ(extension_pref::kExtensionValue
, actual_str_value
);
245 // Test getting a command-line value.
247 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kCommandLinePref
,
248 base::Value::TYPE_STRING
, &value
));
249 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
250 EXPECT_EQ(command_line_pref::kCommandLineValue
, actual_str_value
);
252 // Test getting a user-set value.
254 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kUserPref
,
255 base::Value::TYPE_STRING
, &value
));
256 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
257 EXPECT_EQ(user_pref::kUserValue
, actual_str_value
);
259 // Test getting a user set value overwriting a recommended value.
261 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kRecommendedPref
,
262 base::Value::TYPE_STRING
, &value
));
263 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
264 EXPECT_EQ(recommended_pref::kRecommendedValue
,
267 // Test getting a default value.
269 ASSERT_TRUE(pref_value_store_
->GetValue(prefs::kDefaultPref
,
270 base::Value::TYPE_STRING
, &value
));
271 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
272 EXPECT_EQ(default_pref::kDefaultValue
, actual_str_value
);
274 // Test getting a preference value that the |PrefValueStore|
276 base::FundamentalValue
tmp_dummy_value(true);
277 value
= &tmp_dummy_value
;
278 ASSERT_FALSE(pref_value_store_
->GetValue(prefs::kMissingPref
,
279 base::Value::TYPE_STRING
, &value
));
283 TEST_F(PrefValueStoreTest
, GetRecommendedValue
) {
284 const base::Value
* value
;
286 // The following tests read a value from the PrefService. The preferences are
287 // set in a way such that all lower-priority stores have a value and we can
288 // test whether overrides do not clutter the recommended value.
290 // Test getting recommended value when a managed value is present.
292 ASSERT_TRUE(pref_value_store_
->GetRecommendedValue(
294 base::Value::TYPE_STRING
, &value
));
295 std::string actual_str_value
;
296 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
297 EXPECT_EQ(recommended_pref::kManagedValue
, actual_str_value
);
299 // Test getting recommended value when an extension value is present.
301 ASSERT_TRUE(pref_value_store_
->GetRecommendedValue(
302 prefs::kExtensionPref
,
303 base::Value::TYPE_STRING
, &value
));
304 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
305 EXPECT_EQ(recommended_pref::kExtensionValue
, actual_str_value
);
307 // Test getting recommended value when a command-line value is present.
309 ASSERT_TRUE(pref_value_store_
->GetRecommendedValue(
310 prefs::kCommandLinePref
,
311 base::Value::TYPE_STRING
, &value
));
312 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
313 EXPECT_EQ(recommended_pref::kCommandLineValue
, actual_str_value
);
315 // Test getting recommended value when a user-set value is present.
317 ASSERT_TRUE(pref_value_store_
->GetRecommendedValue(
319 base::Value::TYPE_STRING
, &value
));
320 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
321 EXPECT_EQ(recommended_pref::kUserValue
, actual_str_value
);
323 // Test getting recommended value when no higher-priority value is present.
325 ASSERT_TRUE(pref_value_store_
->GetRecommendedValue(
326 prefs::kRecommendedPref
,
327 base::Value::TYPE_STRING
, &value
));
328 EXPECT_TRUE(value
->GetAsString(&actual_str_value
));
329 EXPECT_EQ(recommended_pref::kRecommendedValue
,
332 // Test getting recommended value when no recommended value is present.
333 base::FundamentalValue
tmp_dummy_value(true);
334 value
= &tmp_dummy_value
;
335 ASSERT_FALSE(pref_value_store_
->GetRecommendedValue(
337 base::Value::TYPE_STRING
, &value
));
340 // Test getting a preference value that the |PrefValueStore|
342 value
= &tmp_dummy_value
;
343 ASSERT_FALSE(pref_value_store_
->GetRecommendedValue(
345 base::Value::TYPE_STRING
, &value
));
349 TEST_F(PrefValueStoreTest
, PrefChanges
) {
350 // Check pref controlled by highest-priority store.
351 ExpectValueChangeNotifications(prefs::kManagedPref
);
352 managed_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
353 CheckAndClearValueChangeNotifications();
355 ExpectValueChangeNotifications(prefs::kManagedPref
);
356 extension_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
357 CheckAndClearValueChangeNotifications();
359 ExpectValueChangeNotifications(prefs::kManagedPref
);
360 command_line_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
361 CheckAndClearValueChangeNotifications();
363 ExpectValueChangeNotifications(prefs::kManagedPref
);
364 user_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
365 CheckAndClearValueChangeNotifications();
367 ExpectValueChangeNotifications(prefs::kManagedPref
);
368 recommended_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
369 CheckAndClearValueChangeNotifications();
371 ExpectValueChangeNotifications(prefs::kManagedPref
);
372 default_pref_store_
->NotifyPrefValueChanged(prefs::kManagedPref
);
373 CheckAndClearValueChangeNotifications();
375 // Check pref controlled by user store.
376 ExpectValueChangeNotifications(prefs::kUserPref
);
377 managed_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
378 CheckAndClearValueChangeNotifications();
380 ExpectValueChangeNotifications(prefs::kUserPref
);
381 extension_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
382 CheckAndClearValueChangeNotifications();
384 ExpectValueChangeNotifications(prefs::kUserPref
);
385 command_line_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
386 CheckAndClearValueChangeNotifications();
388 ExpectValueChangeNotifications(prefs::kUserPref
);
389 user_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
390 CheckAndClearValueChangeNotifications();
392 ExpectValueChangeNotifications(prefs::kUserPref
);
393 recommended_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
394 CheckAndClearValueChangeNotifications();
396 ExpectValueChangeNotifications(prefs::kUserPref
);
397 default_pref_store_
->NotifyPrefValueChanged(prefs::kUserPref
);
398 CheckAndClearValueChangeNotifications();
400 // Check pref controlled by default-pref store.
401 ExpectValueChangeNotifications(prefs::kDefaultPref
);
402 managed_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
403 CheckAndClearValueChangeNotifications();
405 ExpectValueChangeNotifications(prefs::kDefaultPref
);
406 extension_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
407 CheckAndClearValueChangeNotifications();
409 ExpectValueChangeNotifications(prefs::kDefaultPref
);
410 command_line_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
411 CheckAndClearValueChangeNotifications();
413 ExpectValueChangeNotifications(prefs::kDefaultPref
);
414 user_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
415 CheckAndClearValueChangeNotifications();
417 ExpectValueChangeNotifications(prefs::kDefaultPref
);
418 recommended_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
419 CheckAndClearValueChangeNotifications();
421 ExpectValueChangeNotifications(prefs::kDefaultPref
);
422 default_pref_store_
->NotifyPrefValueChanged(prefs::kDefaultPref
);
423 CheckAndClearValueChangeNotifications();
426 TEST_F(PrefValueStoreTest
, OnInitializationCompleted
) {
427 EXPECT_CALL(pref_notifier_
, OnInitializationCompleted(true)).Times(0);
428 managed_pref_store_
->SetInitializationCompleted();
429 extension_pref_store_
->SetInitializationCompleted();
430 command_line_pref_store_
->SetInitializationCompleted();
431 recommended_pref_store_
->SetInitializationCompleted();
432 default_pref_store_
->SetInitializationCompleted();
433 Mock::VerifyAndClearExpectations(&pref_notifier_
);
435 // The notification should only be triggered after the last store is done.
436 EXPECT_CALL(pref_notifier_
, OnInitializationCompleted(true)).Times(1);
437 user_pref_store_
->SetInitializationCompleted();
438 Mock::VerifyAndClearExpectations(&pref_notifier_
);
441 TEST_F(PrefValueStoreTest
, PrefValueInManagedStore
) {
442 EXPECT_TRUE(pref_value_store_
->PrefValueInManagedStore(
443 prefs::kManagedPref
));
444 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
445 prefs::kExtensionPref
));
446 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
447 prefs::kCommandLinePref
));
448 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
450 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
451 prefs::kRecommendedPref
));
452 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
453 prefs::kDefaultPref
));
454 EXPECT_FALSE(pref_value_store_
->PrefValueInManagedStore(
455 prefs::kMissingPref
));
458 TEST_F(PrefValueStoreTest
, PrefValueInExtensionStore
) {
459 EXPECT_TRUE(pref_value_store_
->PrefValueInExtensionStore(
460 prefs::kManagedPref
));
461 EXPECT_TRUE(pref_value_store_
->PrefValueInExtensionStore(
462 prefs::kExtensionPref
));
463 EXPECT_FALSE(pref_value_store_
->PrefValueInExtensionStore(
464 prefs::kCommandLinePref
));
465 EXPECT_FALSE(pref_value_store_
->PrefValueInExtensionStore(
467 EXPECT_FALSE(pref_value_store_
->PrefValueInExtensionStore(
468 prefs::kRecommendedPref
));
469 EXPECT_FALSE(pref_value_store_
->PrefValueInExtensionStore(
470 prefs::kDefaultPref
));
471 EXPECT_FALSE(pref_value_store_
->PrefValueInExtensionStore(
472 prefs::kMissingPref
));
475 TEST_F(PrefValueStoreTest
, PrefValueInUserStore
) {
476 EXPECT_TRUE(pref_value_store_
->PrefValueInUserStore(
477 prefs::kManagedPref
));
478 EXPECT_TRUE(pref_value_store_
->PrefValueInUserStore(
479 prefs::kExtensionPref
));
480 EXPECT_TRUE(pref_value_store_
->PrefValueInUserStore(
481 prefs::kCommandLinePref
));
482 EXPECT_TRUE(pref_value_store_
->PrefValueInUserStore(
484 EXPECT_FALSE(pref_value_store_
->PrefValueInUserStore(
485 prefs::kRecommendedPref
));
486 EXPECT_FALSE(pref_value_store_
->PrefValueInUserStore(
487 prefs::kDefaultPref
));
488 EXPECT_FALSE(pref_value_store_
->PrefValueInUserStore(
489 prefs::kMissingPref
));
492 TEST_F(PrefValueStoreTest
, PrefValueFromExtensionStore
) {
493 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
494 prefs::kManagedPref
));
495 EXPECT_TRUE(pref_value_store_
->PrefValueFromExtensionStore(
496 prefs::kExtensionPref
));
497 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
498 prefs::kCommandLinePref
));
499 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
501 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
502 prefs::kRecommendedPref
));
503 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
504 prefs::kDefaultPref
));
505 EXPECT_FALSE(pref_value_store_
->PrefValueFromExtensionStore(
506 prefs::kMissingPref
));
509 TEST_F(PrefValueStoreTest
, PrefValueFromUserStore
) {
510 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
511 prefs::kManagedPref
));
512 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
513 prefs::kExtensionPref
));
514 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
515 prefs::kCommandLinePref
));
516 EXPECT_TRUE(pref_value_store_
->PrefValueFromUserStore(
518 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
519 prefs::kRecommendedPref
));
520 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
521 prefs::kDefaultPref
));
522 EXPECT_FALSE(pref_value_store_
->PrefValueFromUserStore(
523 prefs::kMissingPref
));
526 TEST_F(PrefValueStoreTest
, PrefValueFromRecommendedStore
) {
527 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
528 prefs::kManagedPref
));
529 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
530 prefs::kExtensionPref
));
531 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
532 prefs::kCommandLinePref
));
533 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
535 EXPECT_TRUE(pref_value_store_
->PrefValueFromRecommendedStore(
536 prefs::kRecommendedPref
));
537 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
538 prefs::kDefaultPref
));
539 EXPECT_FALSE(pref_value_store_
->PrefValueFromRecommendedStore(
540 prefs::kMissingPref
));
543 TEST_F(PrefValueStoreTest
, PrefValueFromDefaultStore
) {
544 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
545 prefs::kManagedPref
));
546 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
547 prefs::kExtensionPref
));
548 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
549 prefs::kCommandLinePref
));
550 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
552 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
553 prefs::kRecommendedPref
));
554 EXPECT_TRUE(pref_value_store_
->PrefValueFromDefaultStore(
555 prefs::kDefaultPref
));
556 EXPECT_FALSE(pref_value_store_
->PrefValueFromDefaultStore(
557 prefs::kMissingPref
));
560 TEST_F(PrefValueStoreTest
, PrefValueUserModifiable
) {
561 EXPECT_FALSE(pref_value_store_
->PrefValueUserModifiable(
562 prefs::kManagedPref
));
563 EXPECT_FALSE(pref_value_store_
->PrefValueUserModifiable(
564 prefs::kExtensionPref
));
565 EXPECT_FALSE(pref_value_store_
->PrefValueUserModifiable(
566 prefs::kCommandLinePref
));
567 EXPECT_TRUE(pref_value_store_
->PrefValueUserModifiable(
569 EXPECT_TRUE(pref_value_store_
->PrefValueUserModifiable(
570 prefs::kRecommendedPref
));
571 EXPECT_TRUE(pref_value_store_
->PrefValueUserModifiable(
572 prefs::kDefaultPref
));
573 EXPECT_TRUE(pref_value_store_
->PrefValueUserModifiable(
574 prefs::kMissingPref
));
577 TEST_F(PrefValueStoreTest
, PrefValueExtensionModifiable
) {
578 EXPECT_FALSE(pref_value_store_
->PrefValueExtensionModifiable(
579 prefs::kManagedPref
));
580 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
581 prefs::kExtensionPref
));
582 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
583 prefs::kCommandLinePref
));
584 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
586 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
587 prefs::kRecommendedPref
));
588 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
589 prefs::kDefaultPref
));
590 EXPECT_TRUE(pref_value_store_
->PrefValueExtensionModifiable(
591 prefs::kMissingPref
));