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

Unified Diff: chrome/browser/policy/config_dir_policy_provider_unittest.cc

Issue 8258018: Generate Chrome policy definition list from policy_templates.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the unittest fix 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/config_dir_policy_provider_unittest.cc
diff --git a/chrome/browser/policy/config_dir_policy_provider_unittest.cc b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
index 9fffad6461019cb106a003b6d408192dfa6c915f..4663991d21902e5e43469c2e45db4b8ab161c413 100644
--- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc
+++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
@@ -186,9 +186,7 @@ class ConfigDirPolicyProviderValueTest
};
TEST_P(ConfigDirPolicyProviderValueTest, Default) {
- ConfigDirPolicyProvider provider(
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
- test_dir());
+ ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
PolicyMap policy_map;
EXPECT_TRUE(provider.Provide(&policy_map));
EXPECT_TRUE(policy_map.empty());
@@ -198,9 +196,7 @@ TEST_P(ConfigDirPolicyProviderValueTest, NullValue) {
DictionaryValue dict;
dict.Set(GetParam().policy_key(), Value::CreateNullValue());
WriteConfigFile(dict, "empty");
- ConfigDirPolicyProvider provider(
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
- test_dir());
+ ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
PolicyMap policy_map;
EXPECT_TRUE(provider.Provide(&policy_map));
EXPECT_TRUE(policy_map.empty());
@@ -210,9 +206,7 @@ TEST_P(ConfigDirPolicyProviderValueTest, TestValue) {
DictionaryValue dict;
dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy());
WriteConfigFile(dict, "policy");
- ConfigDirPolicyProvider provider(
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
- test_dir());
+ ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
PolicyMap policy_map;
EXPECT_TRUE(provider.Provide(&policy_map));
EXPECT_EQ(1U, policy_map.size());
@@ -221,7 +215,9 @@ TEST_P(ConfigDirPolicyProviderValueTest, TestValue) {
EXPECT_TRUE(GetParam().test_value()->Equals(value));
}
-// Test parameters for all supported policies.
+// Test parameters for all supported policies. testing::Values() has a limit of
+// 50 parameters which is reached in this instantiation; new policies should go
+// in a new instantiation.
INSTANTIATE_TEST_CASE_P(
ConfigDirPolicyProviderValueTestInstance,
ConfigDirPolicyProviderValueTest,
@@ -328,12 +324,6 @@ INSTANTIATE_TEST_CASE_P(
ValueTestParams::ForBooleanPolicy(
kPolicyPrintingEnabled,
key::kPrintingEnabled),
- ValueTestParams::ForIntegerPolicy(
- kPolicyDevicePolicyRefreshRate,
- key::kDevicePolicyRefreshRate),
- ValueTestParams::ForIntegerPolicy(
- kPolicyPolicyRefreshRate,
- key::kPolicyRefreshRate),
ValueTestParams::ForBooleanPolicy(
kPolicyInstantEnabled,
key::kInstantEnabled),
@@ -375,14 +365,7 @@ INSTANTIATE_TEST_CASE_P(
key::kDisabledSchemes),
ValueTestParams::ForStringPolicy(
kPolicyDiskCacheDir,
- key::kDiskCacheDir)));
-
-// testing::Values has a limit of 50 test templates, which is reached by the
-// instantiations above. Add tests for new policies here:
-INSTANTIATE_TEST_CASE_P(
- ConfigDirPolicyProviderValueTestInstance2,
- ConfigDirPolicyProviderValueTest,
- testing::Values(
+ key::kDiskCacheDir),
ValueTestParams::ForListPolicy(
kPolicyURLBlacklist,
key::kURLBlacklist),
@@ -390,4 +373,15 @@ INSTANTIATE_TEST_CASE_P(
kPolicyURLWhitelist,
key::kURLWhitelist)));
+// Test parameters for all policies that are supported on ChromeOS only.
+#if defined(OS_CHROMEOS)
+INSTANTIATE_TEST_CASE_P(
+ ConfigDirPolicyProviderValueTestChromeOSInstance,
+ ConfigDirPolicyProviderValueTest,
+ testing::Values(
+ ValueTestParams::ForIntegerPolicy(
+ kPolicyPolicyRefreshRate,
+ key::kPolicyRefreshRate)));
+#endif
+
} // namespace policy
« no previous file with comments | « chrome/browser/policy/config_dir_policy_provider.cc ('k') | chrome/browser/policy/configuration_policy_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698