Index: chrome/browser/policy/configuration_policy_provider_test.cc |
diff --git a/chrome/browser/policy/configuration_policy_provider_test.cc b/chrome/browser/policy/configuration_policy_provider_test.cc |
index e9c8361af409d66072cb8ff15f6021ef860f291c..9915fdfb05db7b6aad27486d423c97b0b73e8242 100644 |
--- a/chrome/browser/policy/configuration_policy_provider_test.cc |
+++ b/chrome/browser/policy/configuration_policy_provider_test.cc |
@@ -111,7 +111,7 @@ const char kTestChromeSchema[] = |
" }" |
"}"; |
-namespace test_policy_definitions { |
+namespace test_keys { |
const char kKeyString[] = "StringPolicy"; |
const char kKeyBoolean[] = "BooleanPolicy"; |
@@ -119,19 +119,7 @@ const char kKeyInteger[] = "IntegerPolicy"; |
const char kKeyStringList[] = "StringListPolicy"; |
const char kKeyDictionary[] = "DictionaryPolicy"; |
-static const PolicyDefinitionList::Entry kEntries[] = { |
- { kKeyString, base::Value::TYPE_STRING }, |
- { kKeyBoolean, base::Value::TYPE_BOOLEAN }, |
- { kKeyInteger, base::Value::TYPE_INTEGER }, |
- { kKeyStringList, base::Value::TYPE_LIST }, |
- { kKeyDictionary, base::Value::TYPE_DICTIONARY }, |
-}; |
- |
-const PolicyDefinitionList kList = { |
- kEntries, kEntries + arraysize(kEntries) |
-}; |
- |
-} // namespace test_policy_definitions |
+} // namespace test_keys |
PolicyTestBase::PolicyTestBase() {} |
@@ -179,7 +167,7 @@ void ConfigurationPolicyProviderTest::SetUp() { |
test_harness_->SetUp(); |
Schema extension_schema = |
- chrome_schema_.GetKnownProperty(test_policy_definitions::kKeyDictionary); |
+ chrome_schema_.GetKnownProperty(test_keys::kKeyDictionary); |
ASSERT_TRUE(extension_schema.valid()); |
schema_registry_.RegisterComponent( |
PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, |
@@ -194,10 +182,8 @@ void ConfigurationPolicyProviderTest::SetUp() { |
"cccccccccccccccccccccccccccccccc"), |
extension_schema); |
- provider_.reset(test_harness_->CreateProvider( |
- &schema_registry_, |
- loop_.message_loop_proxy(), |
- &test_policy_definitions::kList)); |
+ provider_.reset(test_harness_->CreateProvider(&schema_registry_, |
+ loop_.message_loop_proxy())); |
provider_->Init(&schema_registry_); |
// Some providers do a reload on init. Make sure any notifications generated |
// are fired now. |
@@ -245,31 +231,31 @@ TEST_P(ConfigurationPolicyProviderTest, Empty) { |
TEST_P(ConfigurationPolicyProviderTest, StringValue) { |
const char kTestString[] = "string_value"; |
base::StringValue expected_value(kTestString); |
- CheckValue(test_policy_definitions::kKeyString, |
+ CheckValue(test_keys::kKeyString, |
expected_value, |
base::Bind(&PolicyProviderTestHarness::InstallStringPolicy, |
base::Unretained(test_harness_.get()), |
- test_policy_definitions::kKeyString, |
+ test_keys::kKeyString, |
kTestString)); |
} |
TEST_P(ConfigurationPolicyProviderTest, BooleanValue) { |
base::FundamentalValue expected_value(true); |
- CheckValue(test_policy_definitions::kKeyBoolean, |
+ CheckValue(test_keys::kKeyBoolean, |
expected_value, |
base::Bind(&PolicyProviderTestHarness::InstallBooleanPolicy, |
base::Unretained(test_harness_.get()), |
- test_policy_definitions::kKeyBoolean, |
+ test_keys::kKeyBoolean, |
true)); |
} |
TEST_P(ConfigurationPolicyProviderTest, IntegerValue) { |
base::FundamentalValue expected_value(42); |
- CheckValue(test_policy_definitions::kKeyInteger, |
+ CheckValue(test_keys::kKeyInteger, |
expected_value, |
base::Bind(&PolicyProviderTestHarness::InstallIntegerPolicy, |
base::Unretained(test_harness_.get()), |
- test_policy_definitions::kKeyInteger, |
+ test_keys::kKeyInteger, |
42)); |
} |
@@ -277,11 +263,11 @@ TEST_P(ConfigurationPolicyProviderTest, StringListValue) { |
base::ListValue expected_value; |
expected_value.Set(0U, base::Value::CreateStringValue("first")); |
expected_value.Set(1U, base::Value::CreateStringValue("second")); |
- CheckValue(test_policy_definitions::kKeyStringList, |
+ CheckValue(test_keys::kKeyStringList, |
expected_value, |
base::Bind(&PolicyProviderTestHarness::InstallStringListPolicy, |
base::Unretained(test_harness_.get()), |
- test_policy_definitions::kKeyStringList, |
+ test_keys::kKeyStringList, |
&expected_value)); |
} |
@@ -311,11 +297,11 @@ TEST_P(ConfigurationPolicyProviderTest, DictionaryValue) { |
dict->Set("sublist", list); |
expected_value.Set("dictionary", dict); |
- CheckValue(test_policy_definitions::kKeyDictionary, |
+ CheckValue(test_keys::kKeyDictionary, |
expected_value, |
base::Bind(&PolicyProviderTestHarness::InstallDictionaryPolicy, |
base::Unretained(test_harness_.get()), |
- test_policy_definitions::kKeyDictionary, |
+ test_keys::kKeyDictionary, |
&expected_value)); |
} |
@@ -334,15 +320,14 @@ TEST_P(ConfigurationPolicyProviderTest, RefreshPolicies) { |
EXPECT_TRUE(provider_->policies().Equals(bundle)); |
// OnUpdatePolicy is called when there are changes. |
- test_harness_->InstallStringPolicy(test_policy_definitions::kKeyString, |
- "value"); |
+ test_harness_->InstallStringPolicy(test_keys::kKeyString, "value"); |
EXPECT_CALL(observer, OnUpdatePolicy(provider_.get())).Times(1); |
provider_->RefreshPolicies(); |
loop_.RunUntilIdle(); |
Mock::VerifyAndClearExpectations(&observer); |
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
- .Set(test_policy_definitions::kKeyString, |
+ .Set(test_keys::kKeyString, |
test_harness_->policy_level(), |
test_harness_->policy_scope(), |
base::Value::CreateStringValue("value"), |
@@ -413,8 +398,8 @@ TEST_P(Configuration3rdPartyPolicyProviderTest, Load3rdParty) { |
policy_dict.Set("dict", policy_dict.DeepCopy()); |
// Install these policies as a Chrome policy. |
- test_harness_->InstallDictionaryPolicy( |
- test_policy_definitions::kKeyDictionary, &policy_dict); |
+ test_harness_->InstallDictionaryPolicy(test_keys::kKeyDictionary, |
+ &policy_dict); |
// Install them as 3rd party policies too. |
base::DictionaryValue policy_3rdparty; |
policy_3rdparty.Set("extensions.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
@@ -432,7 +417,7 @@ TEST_P(Configuration3rdPartyPolicyProviderTest, Load3rdParty) { |
loop_.RunUntilIdle(); |
PolicyMap expected_policy; |
- expected_policy.Set(test_policy_definitions::kKeyDictionary, |
+ expected_policy.Set(test_keys::kKeyDictionary, |
test_harness_->policy_level(), |
test_harness_->policy_scope(), |
policy_dict.DeepCopy(), |