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

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

Issue 7972013: ConfigurationPolicyPrefStore refactoring to surface error messages. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 9 years, 2 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 TEST_P(ConfigDirPolicyProviderValueTest, Default) { 187 TEST_P(ConfigDirPolicyProviderValueTest, Default) {
188 ConfigDirPolicyProvider provider( 188 ConfigDirPolicyProvider provider(
189 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 189 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
190 test_dir()); 190 test_dir());
191 PolicyMap policy_map; 191 PolicyMap policy_map;
192 EXPECT_TRUE(provider.Provide(&policy_map)); 192 EXPECT_TRUE(provider.Provide(&policy_map));
193 EXPECT_TRUE(policy_map.empty()); 193 EXPECT_TRUE(policy_map.empty());
194 } 194 }
195 195
196 TEST_P(ConfigDirPolicyProviderValueTest, NullValue) {
Mattias Nissler (ping if slow) 2011/09/30 09:01:33 I don't understand why you removed this.
simo 2011/09/30 13:00:41 Because as far as I can see it, this test was mean
Mattias Nissler (ping if slow) 2011/09/30 13:33:35 Ah, I see. This is correct, the test is obsolete.
197 DictionaryValue dict;
198 dict.Set(GetParam().policy_key(), Value::CreateNullValue());
199 WriteConfigFile(dict, "empty");
200 ConfigDirPolicyProvider provider(
201 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
202 test_dir());
203 PolicyMap policy_map;
204 EXPECT_TRUE(provider.Provide(&policy_map));
205 EXPECT_TRUE(policy_map.empty());
206 }
207
208 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) { 196 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) {
209 DictionaryValue dict; 197 DictionaryValue dict;
210 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy()); 198 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy());
211 WriteConfigFile(dict, "policy"); 199 WriteConfigFile(dict, "policy");
212 ConfigDirPolicyProvider provider( 200 ConfigDirPolicyProvider provider(
213 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 201 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
214 test_dir()); 202 test_dir());
215 PolicyMap policy_map; 203 PolicyMap policy_map;
216 EXPECT_TRUE(provider.Provide(&policy_map)); 204 EXPECT_TRUE(provider.Provide(&policy_map));
217 EXPECT_EQ(1U, policy_map.size()); 205 EXPECT_EQ(1U, policy_map.size());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ConfigDirPolicyProviderValueTest, 371 ConfigDirPolicyProviderValueTest,
384 testing::Values( 372 testing::Values(
385 ValueTestParams::ForListPolicy( 373 ValueTestParams::ForListPolicy(
386 kPolicyURLBlacklist, 374 kPolicyURLBlacklist,
387 key::kURLBlacklist), 375 key::kURLBlacklist),
388 ValueTestParams::ForListPolicy( 376 ValueTestParams::ForListPolicy(
389 kPolicyURLWhitelist, 377 kPolicyURLWhitelist,
390 key::kURLWhitelist))); 378 key::kURLWhitelist)));
391 379
392 } // namespace policy 380 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698