blob: 3afe9dcefd19b47adbd934d55c2a02c5b7500154 [file] [log] [blame]
[email protected]4eb4d6ce2012-04-02 14:06:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]d8b08c92010-06-07 13:13:282// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]acd78969c2010-12-08 09:49:115#include <string>
6
[email protected]c17427552012-12-27 13:11:557#include "base/bind.h"
[email protected]b6e695a92011-09-29 15:08:338#include "base/memory/ref_counted.h"
[email protected]3b63f8f42011-03-28 01:54:159#include "base/memory/scoped_ptr.h"
[email protected]03b9b4e2012-10-22 20:01:5210#include "base/prefs/pref_notifier.h"
[email protected]3853a4c2013-02-11 17:15:5711#include "base/prefs/pref_value_store.h"
[email protected]03b9b4e2012-10-22 20:01:5212#include "base/prefs/testing_pref_store.h"
[email protected]d8b08c92010-06-07 13:13:2813#include "base/values.h"
[email protected]d8b08c92010-06-07 13:13:2814#include "testing/gmock/include/gmock/gmock.h"
15#include "testing/gtest/include/gtest/gtest.h"
16
[email protected]d8b08c92010-06-07 13:13:2817using testing::Mock;
[email protected]b6e695a92011-09-29 15:08:3318using testing::_;
[email protected]d8b08c92010-06-07 13:13:2819
[email protected]d81288a02010-08-18 07:25:5020namespace {
21
[email protected]acd78969c2010-12-08 09:49:1122// Allows to capture pref notifications through gmock.
23class MockPrefNotifier : public PrefNotifier {
24 public:
25 MOCK_METHOD1(OnPreferenceChanged, void(const std::string&));
[email protected]845b43a82011-05-11 10:14:4326 MOCK_METHOD1(OnInitializationCompleted, void(bool));
[email protected]d81288a02010-08-18 07:25:5027};
28
[email protected]d36f941b2011-05-09 06:19:1629// Allows to capture sync model associator interaction.
[email protected]c17427552012-12-27 13:11:5530class MockPrefModelAssociator {
[email protected]d36f941b2011-05-09 06:19:1631 public:
32 MOCK_METHOD1(ProcessPrefChange, void(const std::string&));
33};
34
[email protected]d81288a02010-08-18 07:25:5035} // namespace
36
[email protected]887288f02011-02-04 22:52:4637// Names of the preferences used in this test.
[email protected]d8b08c92010-06-07 13:13:2838namespace prefs {
[email protected]4eb4d6ce2012-04-02 14:06:5739const char kManagedPref[] = "this.pref.managed";
[email protected]6c2b0672013-08-29 21:49:1840const char kSupervisedUserPref[] = "this.pref.supervised_user";
[email protected]887288f02011-02-04 22:52:4641const char kCommandLinePref[] = "this.pref.command_line";
42const char kExtensionPref[] = "this.pref.extension";
43const char kUserPref[] = "this.pref.user";
[email protected]4eb4d6ce2012-04-02 14:06:5744const char kRecommendedPref[] = "this.pref.recommended";
[email protected]887288f02011-02-04 22:52:4645const char kDefaultPref[] = "this.pref.default";
[email protected]ce1850e92010-10-15 08:40:5846const char kMissingPref[] = "this.pref.does_not_exist";
[email protected]d8b08c92010-06-07 13:13:2847}
48
[email protected]d81288a02010-08-18 07:25:5049// Potentially expected values of all preferences used in this test program.
[email protected]4eb4d6ce2012-04-02 14:06:5750namespace managed_pref {
51const char kManagedValue[] = "managed:managed";
[email protected]be1c6e922010-11-17 12:49:1752}
53
[email protected]6c2b0672013-08-29 21:49:1854namespace supervised_user_pref {
55const char kManagedValue[] = "supervised_user:managed";
56const char kSupervisedUserValue[] = "supervised_user:supervised_user";
[email protected]607f2432013-08-29 11:53:4057}
58
[email protected]9677c902010-07-13 06:56:3259namespace extension_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5760const char kManagedValue[] = "extension:managed";
[email protected]6c2b0672013-08-29 21:49:1861const char kSupervisedUserValue[] = "extension:supervised_user";
[email protected]887288f02011-02-04 22:52:4662const char kExtensionValue[] = "extension:extension";
[email protected]db198b22010-07-12 16:48:4963}
64
[email protected]8664dfb2010-07-16 11:48:2165namespace command_line_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5766const char kManagedValue[] = "command_line:managed";
[email protected]6c2b0672013-08-29 21:49:1867const char kSupervisedUserValue[] = "command_line:supervised_user";
[email protected]887288f02011-02-04 22:52:4668const char kExtensionValue[] = "command_line:extension";
69const char kCommandLineValue[] = "command_line:command_line";
[email protected]8664dfb2010-07-16 11:48:2170}
71
[email protected]99cc9a02010-09-17 07:53:2872namespace user_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5773const char kManagedValue[] = "user:managed";
[email protected]6c2b0672013-08-29 21:49:1874const char kSupervisedUserValue[] = "supervised_user:supervised_user";
[email protected]887288f02011-02-04 22:52:4675const char kExtensionValue[] = "user:extension";
76const char kCommandLineValue[] = "user:command_line";
77const char kUserValue[] = "user:user";
[email protected]99cc9a02010-09-17 07:53:2878}
79
[email protected]4eb4d6ce2012-04-02 14:06:5780namespace recommended_pref {
81const char kManagedValue[] = "recommended:managed";
[email protected]6c2b0672013-08-29 21:49:1882const char kSupervisedUserValue[] = "recommended:supervised_user";
[email protected]4eb4d6ce2012-04-02 14:06:5783const char kExtensionValue[] = "recommended:extension";
84const char kCommandLineValue[] = "recommended:command_line";
85const char kUserValue[] = "recommended:user";
86const char kRecommendedValue[] = "recommended:recommended";
[email protected]d8b08c92010-06-07 13:13:2887}
88
[email protected]c3b54f372010-09-14 08:25:0789namespace default_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5790const char kManagedValue[] = "default:managed";
[email protected]6c2b0672013-08-29 21:49:1891const char kSupervisedUserValue[] = "default:supervised_user";
[email protected]887288f02011-02-04 22:52:4692const char kExtensionValue[] = "default:extension";
93const char kCommandLineValue[] = "default:command_line";
94const char kUserValue[] = "default:user";
[email protected]4eb4d6ce2012-04-02 14:06:5795const char kRecommendedValue[] = "default:recommended";
[email protected]887288f02011-02-04 22:52:4696const char kDefaultValue[] = "default:default";
[email protected]c3b54f372010-09-14 08:25:0797}
98
[email protected]d8b08c92010-06-07 13:13:2899class PrefValueStoreTest : public testing::Test {
100 protected:
[email protected]d8b08c92010-06-07 13:13:28101 virtual void SetUp() {
[email protected]acd78969c2010-12-08 09:49:11102 // Create TestingPrefStores.
[email protected]4eb4d6ce2012-04-02 14:06:57103 CreateManagedPrefs();
[email protected]6c2b0672013-08-29 21:49:18104 CreateSupervisedUserPrefs();
[email protected]acd78969c2010-12-08 09:49:11105 CreateExtensionPrefs();
106 CreateCommandLinePrefs();
107 CreateUserPrefs();
[email protected]4eb4d6ce2012-04-02 14:06:57108 CreateRecommendedPrefs();
[email protected]acd78969c2010-12-08 09:49:11109 CreateDefaultPrefs();
[email protected]d36f941b2011-05-09 06:19:16110 sync_associator_.reset(new MockPrefModelAssociator());
[email protected]d8b08c92010-06-07 13:13:28111
[email protected]f00768e2010-12-23 12:39:01112 // Create a fresh PrefValueStore.
[email protected]6c2b0672013-08-29 21:49:18113 pref_value_store_.reset(
114 new PrefValueStore(managed_pref_store_.get(),
115 supervised_user_pref_store_.get(),
116 extension_pref_store_.get(),
117 command_line_pref_store_.get(),
118 user_pref_store_.get(),
119 recommended_pref_store_.get(),
120 default_pref_store_.get(),
121 &pref_notifier_));
[email protected]5b199522012-12-22 17:24:44122
[email protected]c17427552012-12-27 13:11:55123 pref_value_store_->set_callback(
124 base::Bind(&MockPrefModelAssociator::ProcessPrefChange,
125 base::Unretained(sync_associator_.get())));
[email protected]d8b08c92010-06-07 13:13:28126 }
127
[email protected]4eb4d6ce2012-04-02 14:06:57128 void CreateManagedPrefs() {
129 managed_pref_store_ = new TestingPrefStore;
130 managed_pref_store_->SetString(
131 prefs::kManagedPref,
132 managed_pref::kManagedValue);
[email protected]d8b08c92010-06-07 13:13:28133 }
134
[email protected]6c2b0672013-08-29 21:49:18135 void CreateSupervisedUserPrefs() {
136 supervised_user_pref_store_ = new TestingPrefStore;
137 supervised_user_pref_store_->SetString(
[email protected]607f2432013-08-29 11:53:40138 prefs::kManagedPref,
[email protected]6c2b0672013-08-29 21:49:18139 supervised_user_pref::kManagedValue);
140 supervised_user_pref_store_->SetString(
141 prefs::kSupervisedUserPref,
142 supervised_user_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40143 }
144
[email protected]acd78969c2010-12-08 09:49:11145 void CreateExtensionPrefs() {
146 extension_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46147 extension_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57148 prefs::kManagedPref,
149 extension_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46150 extension_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18151 prefs::kSupervisedUserPref,
152 extension_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40153 extension_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46154 prefs::kExtensionPref,
155 extension_pref::kExtensionValue);
[email protected]db198b22010-07-12 16:48:49156 }
157
[email protected]acd78969c2010-12-08 09:49:11158 void CreateCommandLinePrefs() {
159 command_line_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46160 command_line_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57161 prefs::kManagedPref,
162 command_line_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46163 command_line_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18164 prefs::kSupervisedUserPref,
165 command_line_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40166 command_line_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46167 prefs::kExtensionPref,
168 command_line_pref::kExtensionValue);
169 command_line_pref_store_->SetString(
170 prefs::kCommandLinePref,
171 command_line_pref::kCommandLineValue);
[email protected]8664dfb2010-07-16 11:48:21172 }
173
[email protected]887288f02011-02-04 22:52:46174 void CreateUserPrefs() {
175 user_pref_store_ = new TestingPrefStore;
176 user_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57177 prefs::kManagedPref,
178 user_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46179 user_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18180 prefs::kSupervisedUserPref,
181 user_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40182 user_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46183 prefs::kCommandLinePref,
184 user_pref::kCommandLineValue);
185 user_pref_store_->SetString(
186 prefs::kExtensionPref,
187 user_pref::kExtensionValue);
188 user_pref_store_->SetString(
189 prefs::kUserPref,
190 user_pref::kUserValue);
191 }
192
[email protected]4eb4d6ce2012-04-02 14:06:57193 void CreateRecommendedPrefs() {
194 recommended_pref_store_ = new TestingPrefStore;
195 recommended_pref_store_->SetString(
196 prefs::kManagedPref,
197 recommended_pref::kManagedValue);
198 recommended_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18199 prefs::kSupervisedUserPref,
200 recommended_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40201 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46202 prefs::kCommandLinePref,
[email protected]4eb4d6ce2012-04-02 14:06:57203 recommended_pref::kCommandLineValue);
204 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46205 prefs::kExtensionPref,
[email protected]4eb4d6ce2012-04-02 14:06:57206 recommended_pref::kExtensionValue);
207 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46208 prefs::kUserPref,
[email protected]4eb4d6ce2012-04-02 14:06:57209 recommended_pref::kUserValue);
210 recommended_pref_store_->SetString(
211 prefs::kRecommendedPref,
212 recommended_pref::kRecommendedValue);
[email protected]c3b54f372010-09-14 08:25:07213 }
214
[email protected]acd78969c2010-12-08 09:49:11215 void CreateDefaultPrefs() {
216 default_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46217 default_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18218 prefs::kSupervisedUserPref,
219 default_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40220 default_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57221 prefs::kManagedPref,
222 default_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46223 default_pref_store_->SetString(
224 prefs::kCommandLinePref,
225 default_pref::kCommandLineValue);
226 default_pref_store_->SetString(
227 prefs::kExtensionPref,
228 default_pref::kExtensionValue);
229 default_pref_store_->SetString(
230 prefs::kUserPref,
231 default_pref::kUserValue);
232 default_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57233 prefs::kRecommendedPref,
234 default_pref::kRecommendedValue);
[email protected]887288f02011-02-04 22:52:46235 default_pref_store_->SetString(
236 prefs::kDefaultPref,
237 default_pref::kDefaultValue);
[email protected]d8b08c92010-06-07 13:13:28238 }
239
[email protected]7ca0f362012-07-30 10:14:03240 void ExpectValueChangeNotifications(const char* name) {
241 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(name));
242 EXPECT_CALL(*sync_associator_, ProcessPrefChange(name));
243 }
244
245 void CheckAndClearValueChangeNotifications() {
246 Mock::VerifyAndClearExpectations(&pref_notifier_);
247 Mock::VerifyAndClearExpectations(sync_associator_.get());
248 }
249
[email protected]acd78969c2010-12-08 09:49:11250 MockPrefNotifier pref_notifier_;
[email protected]d36f941b2011-05-09 06:19:16251 scoped_ptr<MockPrefModelAssociator> sync_associator_;
[email protected]a98ce1262011-01-28 13:20:23252 scoped_ptr<PrefValueStore> pref_value_store_;
[email protected]61f972b2010-08-04 15:31:38253
[email protected]4eb4d6ce2012-04-02 14:06:57254 scoped_refptr<TestingPrefStore> managed_pref_store_;
[email protected]6c2b0672013-08-29 21:49:18255 scoped_refptr<TestingPrefStore> supervised_user_pref_store_;
[email protected]9a8c4022011-01-25 14:25:33256 scoped_refptr<TestingPrefStore> extension_pref_store_;
257 scoped_refptr<TestingPrefStore> command_line_pref_store_;
258 scoped_refptr<TestingPrefStore> user_pref_store_;
[email protected]4eb4d6ce2012-04-02 14:06:57259 scoped_refptr<TestingPrefStore> recommended_pref_store_;
[email protected]9a8c4022011-01-25 14:25:33260 scoped_refptr<TestingPrefStore> default_pref_store_;
[email protected]61f972b2010-08-04 15:31:38261};
[email protected]d8b08c92010-06-07 13:13:28262
[email protected]d8b08c92010-06-07 13:13:28263TEST_F(PrefValueStoreTest, GetValue) {
[email protected]a43a667b2013-06-14 17:56:08264 const base::Value* value;
[email protected]d8b08c92010-06-07 13:13:28265
[email protected]887288f02011-02-04 22:52:46266 // The following tests read a value from the PrefService. The preferences are
267 // set in a way such that all lower-priority stores have a value and we can
268 // test whether overrides work correctly.
269
[email protected]4eb4d6ce2012-04-02 14:06:57270 // Test getting a managed value.
[email protected]d8b08c92010-06-07 13:13:28271 value = NULL;
[email protected]4eb4d6ce2012-04-02 14:06:57272 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kManagedPref,
[email protected]a43a667b2013-06-14 17:56:08273 base::Value::TYPE_STRING, &value));
[email protected]57ecc4b2010-08-11 03:02:51274 std::string actual_str_value;
[email protected]d8b08c92010-06-07 13:13:28275 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]4eb4d6ce2012-04-02 14:06:57276 EXPECT_EQ(managed_pref::kManagedValue, actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28277
[email protected]6c2b0672013-08-29 21:49:18278 // Test getting a supervised user value.
[email protected]607f2432013-08-29 11:53:40279 value = NULL;
[email protected]6c2b0672013-08-29 21:49:18280 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kSupervisedUserPref,
[email protected]607f2432013-08-29 11:53:40281 base::Value::TYPE_STRING, &value));
282 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]6c2b0672013-08-29 21:49:18283 EXPECT_EQ(supervised_user_pref::kSupervisedUserValue, actual_str_value);
[email protected]607f2432013-08-29 11:53:40284
[email protected]887288f02011-02-04 22:52:46285 // Test getting an extension value.
[email protected]db198b22010-07-12 16:48:49286 value = NULL;
[email protected]887288f02011-02-04 22:52:46287 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kExtensionPref,
[email protected]a43a667b2013-06-14 17:56:08288 base::Value::TYPE_STRING, &value));
[email protected]db198b22010-07-12 16:48:49289 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]887288f02011-02-04 22:52:46290 EXPECT_EQ(extension_pref::kExtensionValue, actual_str_value);
[email protected]db198b22010-07-12 16:48:49291
[email protected]887288f02011-02-04 22:52:46292 // Test getting a command-line value.
[email protected]8664dfb2010-07-16 11:48:21293 value = NULL;
[email protected]887288f02011-02-04 22:52:46294 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kCommandLinePref,
[email protected]a43a667b2013-06-14 17:56:08295 base::Value::TYPE_STRING, &value));
[email protected]8664dfb2010-07-16 11:48:21296 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]887288f02011-02-04 22:52:46297 EXPECT_EQ(command_line_pref::kCommandLineValue, actual_str_value);
[email protected]8664dfb2010-07-16 11:48:21298
[email protected]db198b22010-07-12 16:48:49299 // Test getting a user-set value.
[email protected]d8b08c92010-06-07 13:13:28300 value = NULL;
[email protected]887288f02011-02-04 22:52:46301 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kUserPref,
[email protected]a43a667b2013-06-14 17:56:08302 base::Value::TYPE_STRING, &value));
[email protected]887288f02011-02-04 22:52:46303 EXPECT_TRUE(value->GetAsString(&actual_str_value));
304 EXPECT_EQ(user_pref::kUserValue, actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28305
306 // Test getting a user set value overwriting a recommended value.
307 value = NULL;
[email protected]4eb4d6ce2012-04-02 14:06:57308 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kRecommendedPref,
[email protected]a43a667b2013-06-14 17:56:08309 base::Value::TYPE_STRING, &value));
[email protected]887288f02011-02-04 22:52:46310 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]4eb4d6ce2012-04-02 14:06:57311 EXPECT_EQ(recommended_pref::kRecommendedValue,
[email protected]887288f02011-02-04 22:52:46312 actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28313
[email protected]c3b54f372010-09-14 08:25:07314 // Test getting a default value.
315 value = NULL;
[email protected]9a8c4022011-01-25 14:25:33316 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kDefaultPref,
[email protected]a43a667b2013-06-14 17:56:08317 base::Value::TYPE_STRING, &value));
[email protected]887288f02011-02-04 22:52:46318 EXPECT_TRUE(value->GetAsString(&actual_str_value));
319 EXPECT_EQ(default_pref::kDefaultValue, actual_str_value);
[email protected]c3b54f372010-09-14 08:25:07320
[email protected]d8b08c92010-06-07 13:13:28321 // Test getting a preference value that the |PrefValueStore|
322 // does not contain.
[email protected]b20c4472011-08-11 16:01:31323 base::FundamentalValue tmp_dummy_value(true);
[email protected]887288f02011-02-04 22:52:46324 value = &tmp_dummy_value;
[email protected]9a8c4022011-01-25 14:25:33325 ASSERT_FALSE(pref_value_store_->GetValue(prefs::kMissingPref,
[email protected]a43a667b2013-06-14 17:56:08326 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03327 ASSERT_FALSE(value);
328}
329
330TEST_F(PrefValueStoreTest, GetRecommendedValue) {
[email protected]a43a667b2013-06-14 17:56:08331 const base::Value* value;
[email protected]7ca0f362012-07-30 10:14:03332
333 // The following tests read a value from the PrefService. The preferences are
334 // set in a way such that all lower-priority stores have a value and we can
335 // test whether overrides do not clutter the recommended value.
336
337 // Test getting recommended value when a managed value is present.
338 value = NULL;
339 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
340 prefs::kManagedPref,
[email protected]a43a667b2013-06-14 17:56:08341 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03342 std::string actual_str_value;
343 EXPECT_TRUE(value->GetAsString(&actual_str_value));
344 EXPECT_EQ(recommended_pref::kManagedValue, actual_str_value);
345
[email protected]6c2b0672013-08-29 21:49:18346 // Test getting recommended value when a supervised user value is present.
[email protected]607f2432013-08-29 11:53:40347 value = NULL;
348 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
[email protected]6c2b0672013-08-29 21:49:18349 prefs::kSupervisedUserPref,
[email protected]607f2432013-08-29 11:53:40350 base::Value::TYPE_STRING, &value));
351 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]6c2b0672013-08-29 21:49:18352 EXPECT_EQ(recommended_pref::kSupervisedUserValue, actual_str_value);
[email protected]607f2432013-08-29 11:53:40353
[email protected]7ca0f362012-07-30 10:14:03354 // Test getting recommended value when an extension value is present.
355 value = NULL;
356 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
357 prefs::kExtensionPref,
[email protected]a43a667b2013-06-14 17:56:08358 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03359 EXPECT_TRUE(value->GetAsString(&actual_str_value));
360 EXPECT_EQ(recommended_pref::kExtensionValue, actual_str_value);
361
362 // Test getting recommended value when a command-line value is present.
363 value = NULL;
364 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
365 prefs::kCommandLinePref,
[email protected]a43a667b2013-06-14 17:56:08366 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03367 EXPECT_TRUE(value->GetAsString(&actual_str_value));
368 EXPECT_EQ(recommended_pref::kCommandLineValue, actual_str_value);
369
370 // Test getting recommended value when a user-set value is present.
371 value = NULL;
372 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
373 prefs::kUserPref,
[email protected]a43a667b2013-06-14 17:56:08374 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03375 EXPECT_TRUE(value->GetAsString(&actual_str_value));
376 EXPECT_EQ(recommended_pref::kUserValue, actual_str_value);
377
378 // Test getting recommended value when no higher-priority value is present.
379 value = NULL;
380 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
381 prefs::kRecommendedPref,
[email protected]a43a667b2013-06-14 17:56:08382 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03383 EXPECT_TRUE(value->GetAsString(&actual_str_value));
384 EXPECT_EQ(recommended_pref::kRecommendedValue,
385 actual_str_value);
386
387 // Test getting recommended value when no recommended value is present.
388 base::FundamentalValue tmp_dummy_value(true);
389 value = &tmp_dummy_value;
390 ASSERT_FALSE(pref_value_store_->GetRecommendedValue(
391 prefs::kDefaultPref,
[email protected]a43a667b2013-06-14 17:56:08392 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03393 ASSERT_FALSE(value);
394
395 // Test getting a preference value that the |PrefValueStore|
396 // does not contain.
397 value = &tmp_dummy_value;
398 ASSERT_FALSE(pref_value_store_->GetRecommendedValue(
399 prefs::kMissingPref,
[email protected]a43a667b2013-06-14 17:56:08400 base::Value::TYPE_STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03401 ASSERT_FALSE(value);
[email protected]d8b08c92010-06-07 13:13:28402}
403
[email protected]acd78969c2010-12-08 09:49:11404TEST_F(PrefValueStoreTest, PrefChanges) {
[email protected]c3b54f372010-09-14 08:25:07405 // Check pref controlled by highest-priority store.
[email protected]7ca0f362012-07-30 10:14:03406 ExpectValueChangeNotifications(prefs::kManagedPref);
407 managed_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
408 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11409
[email protected]7ca0f362012-07-30 10:14:03410 ExpectValueChangeNotifications(prefs::kManagedPref);
[email protected]6c2b0672013-08-29 21:49:18411 supervised_user_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
[email protected]607f2432013-08-29 11:53:40412 CheckAndClearValueChangeNotifications();
413
414 ExpectValueChangeNotifications(prefs::kManagedPref);
[email protected]7ca0f362012-07-30 10:14:03415 extension_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
416 CheckAndClearValueChangeNotifications();
417
418 ExpectValueChangeNotifications(prefs::kManagedPref);
419 command_line_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
420 CheckAndClearValueChangeNotifications();
421
422 ExpectValueChangeNotifications(prefs::kManagedPref);
423 user_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
424 CheckAndClearValueChangeNotifications();
425
426 ExpectValueChangeNotifications(prefs::kManagedPref);
427 recommended_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
428 CheckAndClearValueChangeNotifications();
429
430 ExpectValueChangeNotifications(prefs::kManagedPref);
431 default_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
432 CheckAndClearValueChangeNotifications();
[email protected]b3247a82010-08-19 09:08:14433
[email protected]c3b54f372010-09-14 08:25:07434 // Check pref controlled by user store.
[email protected]7ca0f362012-07-30 10:14:03435 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]4eb4d6ce2012-04-02 14:06:57436 managed_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03437 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46438
[email protected]7ca0f362012-07-30 10:14:03439 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46440 extension_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03441 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46442
[email protected]7ca0f362012-07-30 10:14:03443 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46444 command_line_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03445 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46446
[email protected]7ca0f362012-07-30 10:14:03447 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46448 user_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03449 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11450
[email protected]7ca0f362012-07-30 10:14:03451 ExpectValueChangeNotifications(prefs::kUserPref);
452 recommended_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
453 CheckAndClearValueChangeNotifications();
454
455 ExpectValueChangeNotifications(prefs::kUserPref);
456 default_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
457 CheckAndClearValueChangeNotifications();
[email protected]b3247a82010-08-19 09:08:14458
[email protected]c3b54f372010-09-14 08:25:07459 // Check pref controlled by default-pref store.
[email protected]7ca0f362012-07-30 10:14:03460 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]4eb4d6ce2012-04-02 14:06:57461 managed_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03462 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46463
[email protected]7ca0f362012-07-30 10:14:03464 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46465 extension_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03466 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46467
[email protected]7ca0f362012-07-30 10:14:03468 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46469 command_line_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03470 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46471
[email protected]7ca0f362012-07-30 10:14:03472 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46473 user_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03474 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46475
[email protected]7ca0f362012-07-30 10:14:03476 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]4eb4d6ce2012-04-02 14:06:57477 recommended_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03478 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46479
[email protected]7ca0f362012-07-30 10:14:03480 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46481 default_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03482 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11483}
484
485TEST_F(PrefValueStoreTest, OnInitializationCompleted) {
[email protected]845b43a82011-05-11 10:14:43486 EXPECT_CALL(pref_notifier_, OnInitializationCompleted(true)).Times(0);
[email protected]4eb4d6ce2012-04-02 14:06:57487 managed_pref_store_->SetInitializationCompleted();
[email protected]6c2b0672013-08-29 21:49:18488 supervised_user_pref_store_->SetInitializationCompleted();
[email protected]acd78969c2010-12-08 09:49:11489 extension_pref_store_->SetInitializationCompleted();
490 command_line_pref_store_->SetInitializationCompleted();
[email protected]4eb4d6ce2012-04-02 14:06:57491 recommended_pref_store_->SetInitializationCompleted();
[email protected]acd78969c2010-12-08 09:49:11492 default_pref_store_->SetInitializationCompleted();
493 Mock::VerifyAndClearExpectations(&pref_notifier_);
494
495 // The notification should only be triggered after the last store is done.
[email protected]845b43a82011-05-11 10:14:43496 EXPECT_CALL(pref_notifier_, OnInitializationCompleted(true)).Times(1);
[email protected]acd78969c2010-12-08 09:49:11497 user_pref_store_->SetInitializationCompleted();
498 Mock::VerifyAndClearExpectations(&pref_notifier_);
[email protected]d81288a02010-08-18 07:25:50499}
500
[email protected]887288f02011-02-04 22:52:46501TEST_F(PrefValueStoreTest, PrefValueInManagedStore) {
502 EXPECT_TRUE(pref_value_store_->PrefValueInManagedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57503 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46504 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]6c2b0672013-08-29 21:49:18505 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40506 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]887288f02011-02-04 22:52:46507 prefs::kExtensionPref));
508 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
509 prefs::kCommandLinePref));
510 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
511 prefs::kUserPref));
512 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57513 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46514 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]c3b54f372010-09-14 08:25:07515 prefs::kDefaultPref));
[email protected]887288f02011-02-04 22:52:46516 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]be1c6e922010-11-17 12:49:17517 prefs::kMissingPref));
[email protected]d8b08c92010-06-07 13:13:28518}
519
[email protected]d7449e82010-07-14 11:42:35520TEST_F(PrefValueStoreTest, PrefValueInExtensionStore) {
[email protected]be1c6e922010-11-17 12:49:17521 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57522 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46523 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]6c2b0672013-08-29 21:49:18524 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40525 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46526 prefs::kExtensionPref));
[email protected]8664dfb2010-07-16 11:48:21527 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46528 prefs::kCommandLinePref));
[email protected]ce1850e92010-10-15 08:40:58529 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46530 prefs::kUserPref));
[email protected]d7449e82010-07-14 11:42:35531 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57532 prefs::kRecommendedPref));
[email protected]c3b54f372010-09-14 08:25:07533 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
534 prefs::kDefaultPref));
[email protected]d7449e82010-07-14 11:42:35535 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
536 prefs::kMissingPref));
[email protected]d7449e82010-07-14 11:42:35537}
538
539TEST_F(PrefValueStoreTest, PrefValueInUserStore) {
[email protected]be1c6e922010-11-17 12:49:17540 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57541 prefs::kManagedPref));
[email protected]8664dfb2010-07-16 11:48:21542 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]6c2b0672013-08-29 21:49:18543 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40544 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]887288f02011-02-04 22:52:46545 prefs::kExtensionPref));
[email protected]ce1850e92010-10-15 08:40:58546 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]887288f02011-02-04 22:52:46547 prefs::kCommandLinePref));
548 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
549 prefs::kUserPref));
[email protected]d7449e82010-07-14 11:42:35550 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57551 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46552 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
553 prefs::kDefaultPref));
554 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
555 prefs::kMissingPref));
556}
557
558TEST_F(PrefValueStoreTest, PrefValueFromExtensionStore) {
559 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57560 prefs::kManagedPref));
[email protected]607f2432013-08-29 11:53:40561 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]6c2b0672013-08-29 21:49:18562 prefs::kSupervisedUserPref));
[email protected]887288f02011-02-04 22:52:46563 EXPECT_TRUE(pref_value_store_->PrefValueFromExtensionStore(
564 prefs::kExtensionPref));
565 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
566 prefs::kCommandLinePref));
567 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
568 prefs::kUserPref));
569 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57570 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46571 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
572 prefs::kDefaultPref));
573 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
574 prefs::kMissingPref));
575}
576
577TEST_F(PrefValueStoreTest, PrefValueFromUserStore) {
[email protected]d7449e82010-07-14 11:42:35578 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57579 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46580 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]6c2b0672013-08-29 21:49:18581 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40582 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]887288f02011-02-04 22:52:46583 prefs::kExtensionPref));
584 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
585 prefs::kCommandLinePref));
586 EXPECT_TRUE(pref_value_store_->PrefValueFromUserStore(
587 prefs::kUserPref));
588 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57589 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46590 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
591 prefs::kDefaultPref));
592 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
593 prefs::kMissingPref));
[email protected]d7449e82010-07-14 11:42:35594}
[email protected]61f972b2010-08-04 15:31:38595
[email protected]a5437282011-12-12 12:33:21596TEST_F(PrefValueStoreTest, PrefValueFromRecommendedStore) {
597 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57598 prefs::kManagedPref));
[email protected]a5437282011-12-12 12:33:21599 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]6c2b0672013-08-29 21:49:18600 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40601 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]a5437282011-12-12 12:33:21602 prefs::kExtensionPref));
603 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
604 prefs::kCommandLinePref));
605 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
606 prefs::kUserPref));
607 EXPECT_TRUE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57608 prefs::kRecommendedPref));
[email protected]a5437282011-12-12 12:33:21609 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
610 prefs::kDefaultPref));
611 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
612 prefs::kMissingPref));
613}
614
[email protected]c3b54f372010-09-14 08:25:07615TEST_F(PrefValueStoreTest, PrefValueFromDefaultStore) {
[email protected]be1c6e922010-11-17 12:49:17616 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]4eb4d6ce2012-04-02 14:06:57617 prefs::kManagedPref));
[email protected]c3b54f372010-09-14 08:25:07618 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]6c2b0672013-08-29 21:49:18619 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40620 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46621 prefs::kExtensionPref));
[email protected]ce1850e92010-10-15 08:40:58622 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46623 prefs::kCommandLinePref));
[email protected]c3b54f372010-09-14 08:25:07624 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46625 prefs::kUserPref));
626 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]4eb4d6ce2012-04-02 14:06:57627 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46628 EXPECT_TRUE(pref_value_store_->PrefValueFromDefaultStore(
629 prefs::kDefaultPref));
630 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
631 prefs::kMissingPref));
632}
[email protected]c3b54f372010-09-14 08:25:07633
[email protected]887288f02011-02-04 22:52:46634TEST_F(PrefValueStoreTest, PrefValueUserModifiable) {
635 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57636 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46637 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]6c2b0672013-08-29 21:49:18638 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40639 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]887288f02011-02-04 22:52:46640 prefs::kExtensionPref));
641 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
642 prefs::kCommandLinePref));
643 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
644 prefs::kUserPref));
645 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57646 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46647 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
648 prefs::kDefaultPref));
649 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
650 prefs::kMissingPref));
[email protected]c3b54f372010-09-14 08:25:07651}
[email protected]9a28f132011-02-24 21:15:16652
653TEST_F(PrefValueStoreTest, PrefValueExtensionModifiable) {
654 EXPECT_FALSE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57655 prefs::kManagedPref));
[email protected]607f2432013-08-29 11:53:40656 EXPECT_FALSE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]6c2b0672013-08-29 21:49:18657 prefs::kSupervisedUserPref));
[email protected]9a28f132011-02-24 21:15:16658 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
659 prefs::kExtensionPref));
660 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
661 prefs::kCommandLinePref));
662 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
663 prefs::kUserPref));
664 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57665 prefs::kRecommendedPref));
[email protected]9a28f132011-02-24 21:15:16666 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
667 prefs::kDefaultPref));
668 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
669 prefs::kMissingPref));
670}