OLD | NEW |
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 Loading... |
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) { | |
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 Loading... |
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 |
OLD | NEW |