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

Unified Diff: components/policy/core/common/configuration_policy_provider_test.cc

Issue 102493002: Use schemas bundled in extensions to convert policies loaded on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years 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: components/policy/core/common/configuration_policy_provider_test.cc
diff --git a/components/policy/core/common/configuration_policy_provider_test.cc b/components/policy/core/common/configuration_policy_provider_test.cc
index 8c5ef3287990a3422f13f200ddd46ec969882c76..5d87cb3d6ba7bd72a72a78705799b8568e446732 100644
--- a/components/policy/core/common/configuration_policy_provider_test.cc
+++ b/components/policy/core/common/configuration_policy_provider_test.cc
@@ -126,17 +126,26 @@ PolicyTestBase::PolicyTestBase() {}
PolicyTestBase::~PolicyTestBase() {}
void PolicyTestBase::SetUp() {
- std::string error;
- chrome_schema_ = Schema::Parse(kTestChromeSchema, &error);
- ASSERT_TRUE(chrome_schema_.valid()) << error;
- schema_registry_.RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""),
- chrome_schema_);
+ const PolicyNamespace ns(POLICY_DOMAIN_CHROME, "");
+ ASSERT_TRUE(RegisterSchema(ns, kTestChromeSchema));
}
void PolicyTestBase::TearDown() {
loop_.RunUntilIdle();
}
+bool PolicyTestBase::RegisterSchema(const PolicyNamespace& ns,
+ const std::string& schema_string) {
+ std::string error;
+ Schema schema = Schema::Parse(schema_string, &error);
+ if (schema.valid()) {
+ schema_registry_.RegisterComponent(ns, schema);
+ return true;
+ }
+ ADD_FAILURE() << error;
+ return false;
+}
+
PolicyProviderTestHarness::PolicyProviderTestHarness(PolicyLevel level,
PolicyScope scope)
: level_(level), scope_(scope) {}
@@ -166,8 +175,10 @@ void ConfigurationPolicyProviderTest::SetUp() {
test_harness_.reset((*GetParam())());
test_harness_->SetUp();
+ const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, "");
+ Schema chrome_schema = *schema_registry_.schema_map()->GetSchema(chrome_ns);
Schema extension_schema =
- chrome_schema_.GetKnownProperty(test_keys::kKeyDictionary);
+ chrome_schema.GetKnownProperty(test_keys::kKeyDictionary);
ASSERT_TRUE(extension_schema.valid());
schema_registry_.RegisterComponent(
PolicyNamespace(POLICY_DOMAIN_EXTENSIONS,
« no previous file with comments | « components/policy/core/common/configuration_policy_provider_test.h ('k') | components/policy/core/common/policy_loader_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698