blob: 7ef66eb56934fcd06cbe0e8d38512d7a0bbf0d61 [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
dcheng5f043bc2016-04-22 19:09:065#include "components/prefs/pref_value_store.h"
6
7#include <memory>
[email protected]acd78969c2010-12-08 09:49:118#include <string>
9
[email protected]c17427552012-12-27 13:11:5510#include "base/bind.h"
[email protected]b6e695a92011-09-29 15:08:3311#include "base/memory/ref_counted.h"
[email protected]d8b08c92010-06-07 13:13:2812#include "base/values.h"
brettwf00b9b42016-02-01 22:11:3813#include "components/prefs/pref_notifier.h"
brettwf00b9b42016-02-01 22:11:3814#include "components/prefs/testing_pref_store.h"
[email protected]d8b08c92010-06-07 13:13:2815#include "testing/gmock/include/gmock/gmock.h"
16#include "testing/gtest/include/gtest/gtest.h"
17
[email protected]d8b08c92010-06-07 13:13:2818using testing::Mock;
[email protected]b6e695a92011-09-29 15:08:3319using testing::_;
[email protected]d8b08c92010-06-07 13:13:2820
[email protected]d81288a02010-08-18 07:25:5021namespace {
22
[email protected]acd78969c2010-12-08 09:49:1123// Allows to capture pref notifications through gmock.
24class MockPrefNotifier : public PrefNotifier {
25 public:
26 MOCK_METHOD1(OnPreferenceChanged, void(const std::string&));
[email protected]845b43a82011-05-11 10:14:4327 MOCK_METHOD1(OnInitializationCompleted, void(bool));
[email protected]d81288a02010-08-18 07:25:5028};
29
[email protected]d36f941b2011-05-09 06:19:1630// Allows to capture sync model associator interaction.
[email protected]c17427552012-12-27 13:11:5531class MockPrefModelAssociator {
[email protected]d36f941b2011-05-09 06:19:1632 public:
33 MOCK_METHOD1(ProcessPrefChange, void(const std::string&));
34};
35
[email protected]d81288a02010-08-18 07:25:5036} // namespace
37
[email protected]887288f02011-02-04 22:52:4638// Names of the preferences used in this test.
[email protected]d8b08c92010-06-07 13:13:2839namespace prefs {
[email protected]4eb4d6ce2012-04-02 14:06:5740const char kManagedPref[] = "this.pref.managed";
[email protected]6c2b0672013-08-29 21:49:1841const char kSupervisedUserPref[] = "this.pref.supervised_user";
[email protected]887288f02011-02-04 22:52:4642const char kCommandLinePref[] = "this.pref.command_line";
43const char kExtensionPref[] = "this.pref.extension";
44const char kUserPref[] = "this.pref.user";
[email protected]4eb4d6ce2012-04-02 14:06:5745const char kRecommendedPref[] = "this.pref.recommended";
[email protected]887288f02011-02-04 22:52:4646const char kDefaultPref[] = "this.pref.default";
[email protected]ce1850e92010-10-15 08:40:5847const char kMissingPref[] = "this.pref.does_not_exist";
[email protected]d8b08c92010-06-07 13:13:2848}
49
[email protected]d81288a02010-08-18 07:25:5050// Potentially expected values of all preferences used in this test program.
[email protected]4eb4d6ce2012-04-02 14:06:5751namespace managed_pref {
52const char kManagedValue[] = "managed:managed";
[email protected]be1c6e922010-11-17 12:49:1753}
54
[email protected]6c2b0672013-08-29 21:49:1855namespace supervised_user_pref {
56const char kManagedValue[] = "supervised_user:managed";
57const char kSupervisedUserValue[] = "supervised_user:supervised_user";
[email protected]607f2432013-08-29 11:53:4058}
59
[email protected]9677c902010-07-13 06:56:3260namespace extension_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5761const char kManagedValue[] = "extension:managed";
[email protected]6c2b0672013-08-29 21:49:1862const char kSupervisedUserValue[] = "extension:supervised_user";
[email protected]887288f02011-02-04 22:52:4663const char kExtensionValue[] = "extension:extension";
[email protected]db198b22010-07-12 16:48:4964}
65
[email protected]8664dfb2010-07-16 11:48:2166namespace command_line_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5767const char kManagedValue[] = "command_line:managed";
[email protected]6c2b0672013-08-29 21:49:1868const char kSupervisedUserValue[] = "command_line:supervised_user";
[email protected]887288f02011-02-04 22:52:4669const char kExtensionValue[] = "command_line:extension";
70const char kCommandLineValue[] = "command_line:command_line";
[email protected]8664dfb2010-07-16 11:48:2171}
72
[email protected]99cc9a02010-09-17 07:53:2873namespace user_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5774const char kManagedValue[] = "user:managed";
[email protected]6c2b0672013-08-29 21:49:1875const char kSupervisedUserValue[] = "supervised_user:supervised_user";
[email protected]887288f02011-02-04 22:52:4676const char kExtensionValue[] = "user:extension";
77const char kCommandLineValue[] = "user:command_line";
78const char kUserValue[] = "user:user";
[email protected]99cc9a02010-09-17 07:53:2879}
80
[email protected]4eb4d6ce2012-04-02 14:06:5781namespace recommended_pref {
82const char kManagedValue[] = "recommended:managed";
[email protected]6c2b0672013-08-29 21:49:1883const char kSupervisedUserValue[] = "recommended:supervised_user";
[email protected]4eb4d6ce2012-04-02 14:06:5784const char kExtensionValue[] = "recommended:extension";
85const char kCommandLineValue[] = "recommended:command_line";
86const char kUserValue[] = "recommended:user";
87const char kRecommendedValue[] = "recommended:recommended";
[email protected]d8b08c92010-06-07 13:13:2888}
89
[email protected]c3b54f372010-09-14 08:25:0790namespace default_pref {
[email protected]4eb4d6ce2012-04-02 14:06:5791const char kManagedValue[] = "default:managed";
[email protected]6c2b0672013-08-29 21:49:1892const char kSupervisedUserValue[] = "default:supervised_user";
[email protected]887288f02011-02-04 22:52:4693const char kExtensionValue[] = "default:extension";
94const char kCommandLineValue[] = "default:command_line";
95const char kUserValue[] = "default:user";
[email protected]4eb4d6ce2012-04-02 14:06:5796const char kRecommendedValue[] = "default:recommended";
[email protected]887288f02011-02-04 22:52:4697const char kDefaultValue[] = "default:default";
[email protected]c3b54f372010-09-14 08:25:0798}
99
[email protected]d8b08c92010-06-07 13:13:28100class PrefValueStoreTest : public testing::Test {
101 protected:
dcheng8aef37612014-12-23 02:56:47102 void SetUp() override {
[email protected]acd78969c2010-12-08 09:49:11103 // Create TestingPrefStores.
[email protected]4eb4d6ce2012-04-02 14:06:57104 CreateManagedPrefs();
[email protected]6c2b0672013-08-29 21:49:18105 CreateSupervisedUserPrefs();
[email protected]acd78969c2010-12-08 09:49:11106 CreateExtensionPrefs();
107 CreateCommandLinePrefs();
108 CreateUserPrefs();
[email protected]4eb4d6ce2012-04-02 14:06:57109 CreateRecommendedPrefs();
[email protected]acd78969c2010-12-08 09:49:11110 CreateDefaultPrefs();
[email protected]d36f941b2011-05-09 06:19:16111 sync_associator_.reset(new MockPrefModelAssociator());
[email protected]d8b08c92010-06-07 13:13:28112
[email protected]f00768e2010-12-23 12:39:01113 // Create a fresh PrefValueStore.
[email protected]6c2b0672013-08-29 21:49:18114 pref_value_store_.reset(
115 new PrefValueStore(managed_pref_store_.get(),
116 supervised_user_pref_store_.get(),
117 extension_pref_store_.get(),
118 command_line_pref_store_.get(),
119 user_pref_store_.get(),
120 recommended_pref_store_.get(),
121 default_pref_store_.get(),
122 &pref_notifier_));
[email protected]5b199522012-12-22 17:24:44123
[email protected]c17427552012-12-27 13:11:55124 pref_value_store_->set_callback(
125 base::Bind(&MockPrefModelAssociator::ProcessPrefChange,
126 base::Unretained(sync_associator_.get())));
[email protected]d8b08c92010-06-07 13:13:28127 }
128
[email protected]4eb4d6ce2012-04-02 14:06:57129 void CreateManagedPrefs() {
130 managed_pref_store_ = new TestingPrefStore;
131 managed_pref_store_->SetString(
132 prefs::kManagedPref,
133 managed_pref::kManagedValue);
[email protected]d8b08c92010-06-07 13:13:28134 }
135
[email protected]6c2b0672013-08-29 21:49:18136 void CreateSupervisedUserPrefs() {
137 supervised_user_pref_store_ = new TestingPrefStore;
138 supervised_user_pref_store_->SetString(
[email protected]607f2432013-08-29 11:53:40139 prefs::kManagedPref,
[email protected]6c2b0672013-08-29 21:49:18140 supervised_user_pref::kManagedValue);
141 supervised_user_pref_store_->SetString(
142 prefs::kSupervisedUserPref,
143 supervised_user_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40144 }
145
[email protected]acd78969c2010-12-08 09:49:11146 void CreateExtensionPrefs() {
147 extension_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46148 extension_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57149 prefs::kManagedPref,
150 extension_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46151 extension_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18152 prefs::kSupervisedUserPref,
153 extension_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40154 extension_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46155 prefs::kExtensionPref,
156 extension_pref::kExtensionValue);
[email protected]db198b22010-07-12 16:48:49157 }
158
[email protected]acd78969c2010-12-08 09:49:11159 void CreateCommandLinePrefs() {
160 command_line_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46161 command_line_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57162 prefs::kManagedPref,
163 command_line_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46164 command_line_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18165 prefs::kSupervisedUserPref,
166 command_line_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40167 command_line_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46168 prefs::kExtensionPref,
169 command_line_pref::kExtensionValue);
170 command_line_pref_store_->SetString(
171 prefs::kCommandLinePref,
172 command_line_pref::kCommandLineValue);
[email protected]8664dfb2010-07-16 11:48:21173 }
174
[email protected]887288f02011-02-04 22:52:46175 void CreateUserPrefs() {
176 user_pref_store_ = new TestingPrefStore;
177 user_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57178 prefs::kManagedPref,
179 user_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46180 user_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18181 prefs::kSupervisedUserPref,
182 user_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40183 user_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46184 prefs::kCommandLinePref,
185 user_pref::kCommandLineValue);
186 user_pref_store_->SetString(
187 prefs::kExtensionPref,
188 user_pref::kExtensionValue);
189 user_pref_store_->SetString(
190 prefs::kUserPref,
191 user_pref::kUserValue);
192 }
193
[email protected]4eb4d6ce2012-04-02 14:06:57194 void CreateRecommendedPrefs() {
195 recommended_pref_store_ = new TestingPrefStore;
196 recommended_pref_store_->SetString(
197 prefs::kManagedPref,
198 recommended_pref::kManagedValue);
199 recommended_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18200 prefs::kSupervisedUserPref,
201 recommended_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40202 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46203 prefs::kCommandLinePref,
[email protected]4eb4d6ce2012-04-02 14:06:57204 recommended_pref::kCommandLineValue);
205 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46206 prefs::kExtensionPref,
[email protected]4eb4d6ce2012-04-02 14:06:57207 recommended_pref::kExtensionValue);
208 recommended_pref_store_->SetString(
[email protected]887288f02011-02-04 22:52:46209 prefs::kUserPref,
[email protected]4eb4d6ce2012-04-02 14:06:57210 recommended_pref::kUserValue);
211 recommended_pref_store_->SetString(
212 prefs::kRecommendedPref,
213 recommended_pref::kRecommendedValue);
[email protected]c3b54f372010-09-14 08:25:07214 }
215
[email protected]acd78969c2010-12-08 09:49:11216 void CreateDefaultPrefs() {
217 default_pref_store_ = new TestingPrefStore;
[email protected]887288f02011-02-04 22:52:46218 default_pref_store_->SetString(
[email protected]6c2b0672013-08-29 21:49:18219 prefs::kSupervisedUserPref,
220 default_pref::kSupervisedUserValue);
[email protected]607f2432013-08-29 11:53:40221 default_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57222 prefs::kManagedPref,
223 default_pref::kManagedValue);
[email protected]887288f02011-02-04 22:52:46224 default_pref_store_->SetString(
225 prefs::kCommandLinePref,
226 default_pref::kCommandLineValue);
227 default_pref_store_->SetString(
228 prefs::kExtensionPref,
229 default_pref::kExtensionValue);
230 default_pref_store_->SetString(
231 prefs::kUserPref,
232 default_pref::kUserValue);
233 default_pref_store_->SetString(
[email protected]4eb4d6ce2012-04-02 14:06:57234 prefs::kRecommendedPref,
235 default_pref::kRecommendedValue);
[email protected]887288f02011-02-04 22:52:46236 default_pref_store_->SetString(
237 prefs::kDefaultPref,
238 default_pref::kDefaultValue);
[email protected]d8b08c92010-06-07 13:13:28239 }
240
georgesak7da6e9d2014-12-03 01:10:29241 void ExpectValueChangeNotifications(const std::string& name) {
[email protected]7ca0f362012-07-30 10:14:03242 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(name));
243 EXPECT_CALL(*sync_associator_, ProcessPrefChange(name));
244 }
245
246 void CheckAndClearValueChangeNotifications() {
247 Mock::VerifyAndClearExpectations(&pref_notifier_);
248 Mock::VerifyAndClearExpectations(sync_associator_.get());
249 }
250
[email protected]acd78969c2010-12-08 09:49:11251 MockPrefNotifier pref_notifier_;
dcheng5f043bc2016-04-22 19:09:06252 std::unique_ptr<MockPrefModelAssociator> sync_associator_;
253 std::unique_ptr<PrefValueStore> pref_value_store_;
[email protected]61f972b2010-08-04 15:31:38254
[email protected]4eb4d6ce2012-04-02 14:06:57255 scoped_refptr<TestingPrefStore> managed_pref_store_;
[email protected]6c2b0672013-08-29 21:49:18256 scoped_refptr<TestingPrefStore> supervised_user_pref_store_;
[email protected]9a8c4022011-01-25 14:25:33257 scoped_refptr<TestingPrefStore> extension_pref_store_;
258 scoped_refptr<TestingPrefStore> command_line_pref_store_;
259 scoped_refptr<TestingPrefStore> user_pref_store_;
[email protected]4eb4d6ce2012-04-02 14:06:57260 scoped_refptr<TestingPrefStore> recommended_pref_store_;
[email protected]9a8c4022011-01-25 14:25:33261 scoped_refptr<TestingPrefStore> default_pref_store_;
[email protected]61f972b2010-08-04 15:31:38262};
[email protected]d8b08c92010-06-07 13:13:28263
[email protected]d8b08c92010-06-07 13:13:28264TEST_F(PrefValueStoreTest, GetValue) {
[email protected]a43a667b2013-06-14 17:56:08265 const base::Value* value;
[email protected]d8b08c92010-06-07 13:13:28266
[email protected]887288f02011-02-04 22:52:46267 // The following tests read a value from the PrefService. The preferences are
268 // set in a way such that all lower-priority stores have a value and we can
269 // test whether overrides work correctly.
270
[email protected]4eb4d6ce2012-04-02 14:06:57271 // Test getting a managed value.
[email protected]d8b08c92010-06-07 13:13:28272 value = NULL;
[email protected]4eb4d6ce2012-04-02 14:06:57273 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kManagedPref,
jdoerriedc72ee942016-12-07 15:43:28274 base::Value::Type::STRING, &value));
[email protected]57ecc4b2010-08-11 03:02:51275 std::string actual_str_value;
[email protected]d8b08c92010-06-07 13:13:28276 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]4eb4d6ce2012-04-02 14:06:57277 EXPECT_EQ(managed_pref::kManagedValue, actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28278
[email protected]6c2b0672013-08-29 21:49:18279 // Test getting a supervised user value.
[email protected]607f2432013-08-29 11:53:40280 value = NULL;
[email protected]6c2b0672013-08-29 21:49:18281 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kSupervisedUserPref,
jdoerriedc72ee942016-12-07 15:43:28282 base::Value::Type::STRING, &value));
[email protected]607f2432013-08-29 11:53:40283 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]6c2b0672013-08-29 21:49:18284 EXPECT_EQ(supervised_user_pref::kSupervisedUserValue, actual_str_value);
[email protected]607f2432013-08-29 11:53:40285
[email protected]887288f02011-02-04 22:52:46286 // Test getting an extension value.
[email protected]db198b22010-07-12 16:48:49287 value = NULL;
[email protected]887288f02011-02-04 22:52:46288 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kExtensionPref,
jdoerriedc72ee942016-12-07 15:43:28289 base::Value::Type::STRING, &value));
[email protected]db198b22010-07-12 16:48:49290 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]887288f02011-02-04 22:52:46291 EXPECT_EQ(extension_pref::kExtensionValue, actual_str_value);
[email protected]db198b22010-07-12 16:48:49292
[email protected]887288f02011-02-04 22:52:46293 // Test getting a command-line value.
[email protected]8664dfb2010-07-16 11:48:21294 value = NULL;
[email protected]887288f02011-02-04 22:52:46295 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kCommandLinePref,
jdoerriedc72ee942016-12-07 15:43:28296 base::Value::Type::STRING, &value));
[email protected]8664dfb2010-07-16 11:48:21297 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]887288f02011-02-04 22:52:46298 EXPECT_EQ(command_line_pref::kCommandLineValue, actual_str_value);
[email protected]8664dfb2010-07-16 11:48:21299
[email protected]db198b22010-07-12 16:48:49300 // Test getting a user-set value.
[email protected]d8b08c92010-06-07 13:13:28301 value = NULL;
[email protected]887288f02011-02-04 22:52:46302 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kUserPref,
jdoerriedc72ee942016-12-07 15:43:28303 base::Value::Type::STRING, &value));
[email protected]887288f02011-02-04 22:52:46304 EXPECT_TRUE(value->GetAsString(&actual_str_value));
305 EXPECT_EQ(user_pref::kUserValue, actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28306
307 // Test getting a user set value overwriting a recommended value.
308 value = NULL;
[email protected]4eb4d6ce2012-04-02 14:06:57309 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kRecommendedPref,
jdoerriedc72ee942016-12-07 15:43:28310 base::Value::Type::STRING, &value));
[email protected]887288f02011-02-04 22:52:46311 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]4eb4d6ce2012-04-02 14:06:57312 EXPECT_EQ(recommended_pref::kRecommendedValue,
[email protected]887288f02011-02-04 22:52:46313 actual_str_value);
[email protected]d8b08c92010-06-07 13:13:28314
[email protected]c3b54f372010-09-14 08:25:07315 // Test getting a default value.
316 value = NULL;
[email protected]9a8c4022011-01-25 14:25:33317 ASSERT_TRUE(pref_value_store_->GetValue(prefs::kDefaultPref,
jdoerriedc72ee942016-12-07 15:43:28318 base::Value::Type::STRING, &value));
[email protected]887288f02011-02-04 22:52:46319 EXPECT_TRUE(value->GetAsString(&actual_str_value));
320 EXPECT_EQ(default_pref::kDefaultValue, actual_str_value);
[email protected]c3b54f372010-09-14 08:25:07321
[email protected]d8b08c92010-06-07 13:13:28322 // Test getting a preference value that the |PrefValueStore|
323 // does not contain.
jdoerrie239723572017-03-02 12:09:19324 base::Value tmp_dummy_value(true);
[email protected]887288f02011-02-04 22:52:46325 value = &tmp_dummy_value;
[email protected]9a8c4022011-01-25 14:25:33326 ASSERT_FALSE(pref_value_store_->GetValue(prefs::kMissingPref,
jdoerriedc72ee942016-12-07 15:43:28327 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03328 ASSERT_FALSE(value);
329}
330
331TEST_F(PrefValueStoreTest, GetRecommendedValue) {
[email protected]a43a667b2013-06-14 17:56:08332 const base::Value* value;
[email protected]7ca0f362012-07-30 10:14:03333
334 // The following tests read a value from the PrefService. The preferences are
335 // set in a way such that all lower-priority stores have a value and we can
336 // test whether overrides do not clutter the recommended value.
337
338 // Test getting recommended value when a managed value is present.
339 value = NULL;
340 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
341 prefs::kManagedPref,
jdoerriedc72ee942016-12-07 15:43:28342 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03343 std::string actual_str_value;
344 EXPECT_TRUE(value->GetAsString(&actual_str_value));
345 EXPECT_EQ(recommended_pref::kManagedValue, actual_str_value);
346
[email protected]6c2b0672013-08-29 21:49:18347 // Test getting recommended value when a supervised user value is present.
[email protected]607f2432013-08-29 11:53:40348 value = NULL;
349 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
[email protected]6c2b0672013-08-29 21:49:18350 prefs::kSupervisedUserPref,
jdoerriedc72ee942016-12-07 15:43:28351 base::Value::Type::STRING, &value));
[email protected]607f2432013-08-29 11:53:40352 EXPECT_TRUE(value->GetAsString(&actual_str_value));
[email protected]6c2b0672013-08-29 21:49:18353 EXPECT_EQ(recommended_pref::kSupervisedUserValue, actual_str_value);
[email protected]607f2432013-08-29 11:53:40354
[email protected]7ca0f362012-07-30 10:14:03355 // Test getting recommended value when an extension value is present.
356 value = NULL;
357 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
358 prefs::kExtensionPref,
jdoerriedc72ee942016-12-07 15:43:28359 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03360 EXPECT_TRUE(value->GetAsString(&actual_str_value));
361 EXPECT_EQ(recommended_pref::kExtensionValue, actual_str_value);
362
363 // Test getting recommended value when a command-line value is present.
364 value = NULL;
365 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
366 prefs::kCommandLinePref,
jdoerriedc72ee942016-12-07 15:43:28367 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03368 EXPECT_TRUE(value->GetAsString(&actual_str_value));
369 EXPECT_EQ(recommended_pref::kCommandLineValue, actual_str_value);
370
371 // Test getting recommended value when a user-set value is present.
372 value = NULL;
373 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
374 prefs::kUserPref,
jdoerriedc72ee942016-12-07 15:43:28375 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03376 EXPECT_TRUE(value->GetAsString(&actual_str_value));
377 EXPECT_EQ(recommended_pref::kUserValue, actual_str_value);
378
379 // Test getting recommended value when no higher-priority value is present.
380 value = NULL;
381 ASSERT_TRUE(pref_value_store_->GetRecommendedValue(
382 prefs::kRecommendedPref,
jdoerriedc72ee942016-12-07 15:43:28383 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03384 EXPECT_TRUE(value->GetAsString(&actual_str_value));
385 EXPECT_EQ(recommended_pref::kRecommendedValue,
386 actual_str_value);
387
388 // Test getting recommended value when no recommended value is present.
jdoerrie239723572017-03-02 12:09:19389 base::Value tmp_dummy_value(true);
[email protected]7ca0f362012-07-30 10:14:03390 value = &tmp_dummy_value;
391 ASSERT_FALSE(pref_value_store_->GetRecommendedValue(
392 prefs::kDefaultPref,
jdoerriedc72ee942016-12-07 15:43:28393 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03394 ASSERT_FALSE(value);
395
396 // Test getting a preference value that the |PrefValueStore|
397 // does not contain.
398 value = &tmp_dummy_value;
399 ASSERT_FALSE(pref_value_store_->GetRecommendedValue(
400 prefs::kMissingPref,
jdoerriedc72ee942016-12-07 15:43:28401 base::Value::Type::STRING, &value));
[email protected]7ca0f362012-07-30 10:14:03402 ASSERT_FALSE(value);
[email protected]d8b08c92010-06-07 13:13:28403}
404
[email protected]acd78969c2010-12-08 09:49:11405TEST_F(PrefValueStoreTest, PrefChanges) {
[email protected]c3b54f372010-09-14 08:25:07406 // Check pref controlled by highest-priority store.
[email protected]7ca0f362012-07-30 10:14:03407 ExpectValueChangeNotifications(prefs::kManagedPref);
408 managed_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
409 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11410
[email protected]7ca0f362012-07-30 10:14:03411 ExpectValueChangeNotifications(prefs::kManagedPref);
[email protected]6c2b0672013-08-29 21:49:18412 supervised_user_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
[email protected]607f2432013-08-29 11:53:40413 CheckAndClearValueChangeNotifications();
414
415 ExpectValueChangeNotifications(prefs::kManagedPref);
[email protected]7ca0f362012-07-30 10:14:03416 extension_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
417 CheckAndClearValueChangeNotifications();
418
419 ExpectValueChangeNotifications(prefs::kManagedPref);
420 command_line_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
421 CheckAndClearValueChangeNotifications();
422
423 ExpectValueChangeNotifications(prefs::kManagedPref);
424 user_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
425 CheckAndClearValueChangeNotifications();
426
427 ExpectValueChangeNotifications(prefs::kManagedPref);
428 recommended_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
429 CheckAndClearValueChangeNotifications();
430
431 ExpectValueChangeNotifications(prefs::kManagedPref);
432 default_pref_store_->NotifyPrefValueChanged(prefs::kManagedPref);
433 CheckAndClearValueChangeNotifications();
[email protected]b3247a82010-08-19 09:08:14434
[email protected]c3b54f372010-09-14 08:25:07435 // Check pref controlled by user store.
[email protected]7ca0f362012-07-30 10:14:03436 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]4eb4d6ce2012-04-02 14:06:57437 managed_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03438 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46439
[email protected]7ca0f362012-07-30 10:14:03440 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46441 extension_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03442 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46443
[email protected]7ca0f362012-07-30 10:14:03444 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46445 command_line_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03446 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46447
[email protected]7ca0f362012-07-30 10:14:03448 ExpectValueChangeNotifications(prefs::kUserPref);
[email protected]887288f02011-02-04 22:52:46449 user_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
[email protected]7ca0f362012-07-30 10:14:03450 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11451
[email protected]7ca0f362012-07-30 10:14:03452 ExpectValueChangeNotifications(prefs::kUserPref);
453 recommended_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
454 CheckAndClearValueChangeNotifications();
455
456 ExpectValueChangeNotifications(prefs::kUserPref);
457 default_pref_store_->NotifyPrefValueChanged(prefs::kUserPref);
458 CheckAndClearValueChangeNotifications();
[email protected]b3247a82010-08-19 09:08:14459
[email protected]c3b54f372010-09-14 08:25:07460 // Check pref controlled by default-pref store.
[email protected]7ca0f362012-07-30 10:14:03461 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]4eb4d6ce2012-04-02 14:06:57462 managed_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03463 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46464
[email protected]7ca0f362012-07-30 10:14:03465 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46466 extension_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03467 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46468
[email protected]7ca0f362012-07-30 10:14:03469 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46470 command_line_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03471 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46472
[email protected]7ca0f362012-07-30 10:14:03473 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46474 user_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03475 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46476
[email protected]7ca0f362012-07-30 10:14:03477 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]4eb4d6ce2012-04-02 14:06:57478 recommended_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03479 CheckAndClearValueChangeNotifications();
[email protected]887288f02011-02-04 22:52:46480
[email protected]7ca0f362012-07-30 10:14:03481 ExpectValueChangeNotifications(prefs::kDefaultPref);
[email protected]887288f02011-02-04 22:52:46482 default_pref_store_->NotifyPrefValueChanged(prefs::kDefaultPref);
[email protected]7ca0f362012-07-30 10:14:03483 CheckAndClearValueChangeNotifications();
[email protected]acd78969c2010-12-08 09:49:11484}
485
486TEST_F(PrefValueStoreTest, OnInitializationCompleted) {
[email protected]845b43a82011-05-11 10:14:43487 EXPECT_CALL(pref_notifier_, OnInitializationCompleted(true)).Times(0);
[email protected]4eb4d6ce2012-04-02 14:06:57488 managed_pref_store_->SetInitializationCompleted();
[email protected]6c2b0672013-08-29 21:49:18489 supervised_user_pref_store_->SetInitializationCompleted();
[email protected]acd78969c2010-12-08 09:49:11490 extension_pref_store_->SetInitializationCompleted();
491 command_line_pref_store_->SetInitializationCompleted();
[email protected]4eb4d6ce2012-04-02 14:06:57492 recommended_pref_store_->SetInitializationCompleted();
[email protected]acd78969c2010-12-08 09:49:11493 default_pref_store_->SetInitializationCompleted();
494 Mock::VerifyAndClearExpectations(&pref_notifier_);
495
496 // The notification should only be triggered after the last store is done.
[email protected]845b43a82011-05-11 10:14:43497 EXPECT_CALL(pref_notifier_, OnInitializationCompleted(true)).Times(1);
[email protected]acd78969c2010-12-08 09:49:11498 user_pref_store_->SetInitializationCompleted();
499 Mock::VerifyAndClearExpectations(&pref_notifier_);
[email protected]d81288a02010-08-18 07:25:50500}
501
[email protected]887288f02011-02-04 22:52:46502TEST_F(PrefValueStoreTest, PrefValueInManagedStore) {
503 EXPECT_TRUE(pref_value_store_->PrefValueInManagedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57504 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46505 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]6c2b0672013-08-29 21:49:18506 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40507 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]887288f02011-02-04 22:52:46508 prefs::kExtensionPref));
509 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
510 prefs::kCommandLinePref));
511 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
512 prefs::kUserPref));
513 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57514 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46515 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]c3b54f372010-09-14 08:25:07516 prefs::kDefaultPref));
[email protected]887288f02011-02-04 22:52:46517 EXPECT_FALSE(pref_value_store_->PrefValueInManagedStore(
[email protected]be1c6e922010-11-17 12:49:17518 prefs::kMissingPref));
[email protected]d8b08c92010-06-07 13:13:28519}
520
[email protected]d7449e82010-07-14 11:42:35521TEST_F(PrefValueStoreTest, PrefValueInExtensionStore) {
[email protected]be1c6e922010-11-17 12:49:17522 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57523 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46524 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]6c2b0672013-08-29 21:49:18525 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40526 EXPECT_TRUE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46527 prefs::kExtensionPref));
[email protected]8664dfb2010-07-16 11:48:21528 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46529 prefs::kCommandLinePref));
[email protected]ce1850e92010-10-15 08:40:58530 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]887288f02011-02-04 22:52:46531 prefs::kUserPref));
[email protected]d7449e82010-07-14 11:42:35532 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57533 prefs::kRecommendedPref));
[email protected]c3b54f372010-09-14 08:25:07534 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
535 prefs::kDefaultPref));
[email protected]d7449e82010-07-14 11:42:35536 EXPECT_FALSE(pref_value_store_->PrefValueInExtensionStore(
537 prefs::kMissingPref));
[email protected]d7449e82010-07-14 11:42:35538}
539
540TEST_F(PrefValueStoreTest, PrefValueInUserStore) {
[email protected]be1c6e922010-11-17 12:49:17541 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57542 prefs::kManagedPref));
[email protected]8664dfb2010-07-16 11:48:21543 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]6c2b0672013-08-29 21:49:18544 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40545 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]887288f02011-02-04 22:52:46546 prefs::kExtensionPref));
[email protected]ce1850e92010-10-15 08:40:58547 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
[email protected]887288f02011-02-04 22:52:46548 prefs::kCommandLinePref));
549 EXPECT_TRUE(pref_value_store_->PrefValueInUserStore(
550 prefs::kUserPref));
[email protected]d7449e82010-07-14 11:42:35551 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57552 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46553 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
554 prefs::kDefaultPref));
555 EXPECT_FALSE(pref_value_store_->PrefValueInUserStore(
556 prefs::kMissingPref));
557}
558
559TEST_F(PrefValueStoreTest, PrefValueFromExtensionStore) {
560 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57561 prefs::kManagedPref));
[email protected]607f2432013-08-29 11:53:40562 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]6c2b0672013-08-29 21:49:18563 prefs::kSupervisedUserPref));
[email protected]887288f02011-02-04 22:52:46564 EXPECT_TRUE(pref_value_store_->PrefValueFromExtensionStore(
565 prefs::kExtensionPref));
566 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
567 prefs::kCommandLinePref));
568 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
569 prefs::kUserPref));
570 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
[email protected]4eb4d6ce2012-04-02 14:06:57571 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46572 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
573 prefs::kDefaultPref));
574 EXPECT_FALSE(pref_value_store_->PrefValueFromExtensionStore(
575 prefs::kMissingPref));
576}
577
578TEST_F(PrefValueStoreTest, PrefValueFromUserStore) {
[email protected]d7449e82010-07-14 11:42:35579 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57580 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46581 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]6c2b0672013-08-29 21:49:18582 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40583 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]887288f02011-02-04 22:52:46584 prefs::kExtensionPref));
585 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
586 prefs::kCommandLinePref));
587 EXPECT_TRUE(pref_value_store_->PrefValueFromUserStore(
588 prefs::kUserPref));
589 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
[email protected]4eb4d6ce2012-04-02 14:06:57590 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46591 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
592 prefs::kDefaultPref));
593 EXPECT_FALSE(pref_value_store_->PrefValueFromUserStore(
594 prefs::kMissingPref));
[email protected]d7449e82010-07-14 11:42:35595}
[email protected]61f972b2010-08-04 15:31:38596
[email protected]a5437282011-12-12 12:33:21597TEST_F(PrefValueStoreTest, PrefValueFromRecommendedStore) {
598 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57599 prefs::kManagedPref));
[email protected]a5437282011-12-12 12:33:21600 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]6c2b0672013-08-29 21:49:18601 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40602 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]a5437282011-12-12 12:33:21603 prefs::kExtensionPref));
604 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
605 prefs::kCommandLinePref));
606 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
607 prefs::kUserPref));
608 EXPECT_TRUE(pref_value_store_->PrefValueFromRecommendedStore(
[email protected]4eb4d6ce2012-04-02 14:06:57609 prefs::kRecommendedPref));
[email protected]a5437282011-12-12 12:33:21610 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
611 prefs::kDefaultPref));
612 EXPECT_FALSE(pref_value_store_->PrefValueFromRecommendedStore(
613 prefs::kMissingPref));
614}
615
[email protected]c3b54f372010-09-14 08:25:07616TEST_F(PrefValueStoreTest, PrefValueFromDefaultStore) {
[email protected]be1c6e922010-11-17 12:49:17617 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]4eb4d6ce2012-04-02 14:06:57618 prefs::kManagedPref));
[email protected]c3b54f372010-09-14 08:25:07619 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]6c2b0672013-08-29 21:49:18620 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40621 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46622 prefs::kExtensionPref));
[email protected]ce1850e92010-10-15 08:40:58623 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46624 prefs::kCommandLinePref));
[email protected]c3b54f372010-09-14 08:25:07625 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]887288f02011-02-04 22:52:46626 prefs::kUserPref));
627 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
[email protected]4eb4d6ce2012-04-02 14:06:57628 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46629 EXPECT_TRUE(pref_value_store_->PrefValueFromDefaultStore(
630 prefs::kDefaultPref));
631 EXPECT_FALSE(pref_value_store_->PrefValueFromDefaultStore(
632 prefs::kMissingPref));
633}
[email protected]c3b54f372010-09-14 08:25:07634
[email protected]887288f02011-02-04 22:52:46635TEST_F(PrefValueStoreTest, PrefValueUserModifiable) {
636 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57637 prefs::kManagedPref));
[email protected]887288f02011-02-04 22:52:46638 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]6c2b0672013-08-29 21:49:18639 prefs::kSupervisedUserPref));
[email protected]607f2432013-08-29 11:53:40640 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
[email protected]887288f02011-02-04 22:52:46641 prefs::kExtensionPref));
642 EXPECT_FALSE(pref_value_store_->PrefValueUserModifiable(
643 prefs::kCommandLinePref));
644 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
645 prefs::kUserPref));
646 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57647 prefs::kRecommendedPref));
[email protected]887288f02011-02-04 22:52:46648 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
649 prefs::kDefaultPref));
650 EXPECT_TRUE(pref_value_store_->PrefValueUserModifiable(
651 prefs::kMissingPref));
[email protected]c3b54f372010-09-14 08:25:07652}
[email protected]9a28f132011-02-24 21:15:16653
654TEST_F(PrefValueStoreTest, PrefValueExtensionModifiable) {
655 EXPECT_FALSE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57656 prefs::kManagedPref));
[email protected]607f2432013-08-29 11:53:40657 EXPECT_FALSE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]6c2b0672013-08-29 21:49:18658 prefs::kSupervisedUserPref));
[email protected]9a28f132011-02-24 21:15:16659 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
660 prefs::kExtensionPref));
661 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
662 prefs::kCommandLinePref));
663 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
664 prefs::kUserPref));
665 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
[email protected]4eb4d6ce2012-04-02 14:06:57666 prefs::kRecommendedPref));
[email protected]9a28f132011-02-24 21:15:16667 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
668 prefs::kDefaultPref));
669 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable(
670 prefs::kMissingPref));
671}