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/json/json_value_serializer.h" | 8 #include "base/json/json_value_serializer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 TEST_P(ConfigDirPolicyProviderValueTest, Default) { | 188 TEST_P(ConfigDirPolicyProviderValueTest, Default) { |
189 ConfigDirPolicyProvider provider( | 189 ConfigDirPolicyProvider provider( |
190 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 190 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
191 test_dir()); | 191 test_dir()); |
192 PolicyMap policy_map; | 192 PolicyMap policy_map; |
193 EXPECT_TRUE(provider.Provide(&policy_map)); | 193 EXPECT_TRUE(provider.Provide(&policy_map)); |
194 EXPECT_TRUE(policy_map.empty()); | 194 EXPECT_TRUE(policy_map.empty()); |
195 } | 195 } |
196 | 196 |
197 TEST_P(ConfigDirPolicyProviderValueTest, NullValue) { | |
198 DictionaryValue dict; | |
199 dict.Set(GetParam().policy_key(), Value::CreateNullValue()); | |
200 WriteConfigFile(dict, "empty"); | |
201 ConfigDirPolicyProvider provider( | |
202 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | |
203 test_dir()); | |
204 PolicyMap policy_map; | |
205 EXPECT_TRUE(provider.Provide(&policy_map)); | |
206 EXPECT_TRUE(policy_map.empty()); | |
207 } | |
208 | |
209 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) { | 197 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) { |
210 DictionaryValue dict; | 198 DictionaryValue dict; |
211 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy()); | 199 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy()); |
212 WriteConfigFile(dict, "policy"); | 200 WriteConfigFile(dict, "policy"); |
213 ConfigDirPolicyProvider provider( | 201 ConfigDirPolicyProvider provider( |
214 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 202 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
215 test_dir()); | 203 test_dir()); |
216 PolicyMap policy_map; | 204 PolicyMap policy_map; |
217 EXPECT_TRUE(provider.Provide(&policy_map)); | 205 EXPECT_TRUE(provider.Provide(&policy_map)); |
218 EXPECT_EQ(1U, policy_map.size()); | 206 EXPECT_EQ(1U, policy_map.size()); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 ConfigDirPolicyProviderValueTest, | 372 ConfigDirPolicyProviderValueTest, |
385 testing::Values( | 373 testing::Values( |
386 ValueTestParams::ForListPolicy( | 374 ValueTestParams::ForListPolicy( |
387 kPolicyURLBlacklist, | 375 kPolicyURLBlacklist, |
388 key::kURLBlacklist), | 376 key::kURLBlacklist), |
389 ValueTestParams::ForListPolicy( | 377 ValueTestParams::ForListPolicy( |
390 kPolicyURLWhitelist, | 378 kPolicyURLWhitelist, |
391 key::kURLWhitelist))); | 379 key::kURLWhitelist))); |
392 | 380 |
393 } // namespace policy | 381 } // namespace policy |
OLD | NEW |