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

Side by Side Diff: chrome/browser/policy/config_dir_policy_provider_unittest.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 ConfigurationPolicyType type() const { return type_; } 133 ConfigurationPolicyType type() const { return type_; }
134 const char* policy_key() const { return policy_key_; } 134 const char* policy_key() const { return policy_key_; }
135 const Value* test_value() const { return test_value_.get(); } 135 const Value* test_value() const { return test_value_.get(); }
136 136
137 // Factory methods that create parameter objects for different value types. 137 // Factory methods that create parameter objects for different value types.
138 static ValueTestParams ForStringPolicy( 138 static ValueTestParams ForStringPolicy(
139 ConfigurationPolicyType type, 139 ConfigurationPolicyType type,
140 const char* policy_key) { 140 const char* policy_key) {
141 return ValueTestParams(type, policy_key, Value::CreateStringValue("test")); 141 return ValueTestParams(type, policy_key, base::StringValue::New("test"));
142 } 142 }
143 static ValueTestParams ForBooleanPolicy( 143 static ValueTestParams ForBooleanPolicy(
144 ConfigurationPolicyType type, 144 ConfigurationPolicyType type,
145 const char* policy_key) { 145 const char* policy_key) {
146 return ValueTestParams(type, policy_key, Value::CreateBooleanValue(true)); 146 return ValueTestParams(type, policy_key, base::TrueValue());
147 } 147 }
148 static ValueTestParams ForIntegerPolicy( 148 static ValueTestParams ForIntegerPolicy(
149 ConfigurationPolicyType type, 149 ConfigurationPolicyType type,
150 const char* policy_key) { 150 const char* policy_key) {
151 return ValueTestParams(type, policy_key, Value::CreateIntegerValue(42)); 151 return ValueTestParams(type, policy_key, base::NumberValue::New(42));
152 } 152 }
153 static ValueTestParams ForListPolicy( 153 static ValueTestParams ForListPolicy(
154 ConfigurationPolicyType type, 154 ConfigurationPolicyType type,
155 const char* policy_key) { 155 const char* policy_key) {
156 ListValue* value = new ListValue(); 156 ListValue* value = new ListValue();
157 value->Set(0U, Value::CreateStringValue("first")); 157 value->Set(0U, base::StringValue::New("first"));
158 value->Set(1U, Value::CreateStringValue("second")); 158 value->Set(1U, base::StringValue::New("second"));
159 return ValueTestParams(type, policy_key, value); 159 return ValueTestParams(type, policy_key, value);
160 } 160 }
161 161
162 private: 162 private:
163 ConfigurationPolicyType type_; 163 ConfigurationPolicyType type_;
164 const char* policy_key_; 164 const char* policy_key_;
165 scoped_ptr<Value> test_value_; 165 scoped_ptr<Value> test_value_;
166 }; 166 };
167 167
168 // Tests whether the provider correctly reads a value from the file and forwards 168 // Tests whether the provider correctly reads a value from the file and forwards
(...skipping 21 matching lines...) Expand all
190 TEST_P(ConfigDirPolicyProviderValueTest, Default) { 190 TEST_P(ConfigDirPolicyProviderValueTest, Default) {
191 ConfigDirPolicyProvider provider( 191 ConfigDirPolicyProvider provider(
192 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 192 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
193 test_dir()); 193 test_dir());
194 EXPECT_TRUE(provider.Provide(&policy_store_)); 194 EXPECT_TRUE(provider.Provide(&policy_store_));
195 EXPECT_TRUE(policy_store_.policy_map().empty()); 195 EXPECT_TRUE(policy_store_.policy_map().empty());
196 } 196 }
197 197
198 TEST_P(ConfigDirPolicyProviderValueTest, NullValue) { 198 TEST_P(ConfigDirPolicyProviderValueTest, NullValue) {
199 DictionaryValue dict; 199 DictionaryValue dict;
200 dict.Set(GetParam().policy_key(), Value::CreateNullValue()); 200 dict.Set(GetParam().policy_key(), base::NullValue());
201 WriteConfigFile(dict, "empty"); 201 WriteConfigFile(dict, "empty");
202 ConfigDirPolicyProvider provider( 202 ConfigDirPolicyProvider provider(
203 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 203 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
204 test_dir()); 204 test_dir());
205 EXPECT_TRUE(provider.Provide(&policy_store_)); 205 EXPECT_TRUE(provider.Provide(&policy_store_));
206 EXPECT_TRUE(policy_store_.policy_map().empty()); 206 EXPECT_TRUE(policy_store_.policy_map().empty());
207 } 207 }
208 208
209 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) { 209 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) {
210 DictionaryValue dict; 210 DictionaryValue dict;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 kPolicyEditBookmarksEnabled, 370 kPolicyEditBookmarksEnabled,
371 key::kEditBookmarksEnabled), 371 key::kEditBookmarksEnabled),
372 ValueTestParams::ForListPolicy( 372 ValueTestParams::ForListPolicy(
373 kPolicyDisabledSchemes, 373 kPolicyDisabledSchemes,
374 key::kDisabledSchemes), 374 key::kDisabledSchemes),
375 ValueTestParams::ForStringPolicy( 375 ValueTestParams::ForStringPolicy(
376 kPolicyDiskCacheDir, 376 kPolicyDiskCacheDir,
377 key::kDiskCacheDir))); 377 key::kDiskCacheDir)));
378 378
379 } // namespace policy 379 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_provider_unittest.cc ('k') | chrome/browser/policy/configuration_policy_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698