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

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

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: fixed win tests Created 7 years, 1 month 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/policy_loader_win_unittest.cc
diff --git a/chrome/browser/policy/policy_loader_win_unittest.cc b/chrome/browser/policy/policy_loader_win_unittest.cc
index de822a1344f7bc9d17b7df28fc2f834ea6868459..6e18e3d70338edcc7a8eb72255ec8e87ea2c0bf1 100644
--- a/chrome/browser/policy/policy_loader_win_unittest.cc
+++ b/chrome/browser/policy/policy_loader_win_unittest.cc
@@ -252,6 +252,7 @@ class RegistryTestHarness : public PolicyProviderTestHarness,
virtual void SetUp() OVERRIDE;
virtual ConfigurationPolicyProvider* CreateProvider(
+ SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner,
const PolicyDefinitionList* policy_list) OVERRIDE;
@@ -303,6 +304,7 @@ class PRegTestHarness : public PolicyProviderTestHarness,
virtual void SetUp() OVERRIDE;
virtual ConfigurationPolicyProvider* CreateProvider(
+ SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner,
const PolicyDefinitionList* policy_list) OVERRIDE;
@@ -420,11 +422,12 @@ RegistryTestHarness::~RegistryTestHarness() {}
void RegistryTestHarness::SetUp() {}
ConfigurationPolicyProvider* RegistryTestHarness::CreateProvider(
+ SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner,
const PolicyDefinitionList* policy_list) {
scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(
task_runner, policy_list, kRegistryChromePolicyKey, this));
- return new AsyncPolicyProvider(loader.Pass());
+ return new AsyncPolicyProvider(registry, loader.Pass());
}
void RegistryTestHarness::InstallEmptyPolicy() {}
@@ -552,11 +555,12 @@ void PRegTestHarness::SetUp() {
}
ConfigurationPolicyProvider* PRegTestHarness::CreateProvider(
+ SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner,
const PolicyDefinitionList* policy_list) {
scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(
task_runner, policy_list, kRegistryChromePolicyKey, this));
- return new AsyncPolicyProvider(loader.Pass());
+ return new AsyncPolicyProvider(registry, loader.Pass());
}
void PRegTestHarness::InstallEmptyPolicy() {}
@@ -789,12 +793,25 @@ class PolicyLoaderWinTest : public PolicyTestBase,
virtual ~PolicyLoaderWinTest() {}
virtual void SetUp() OVERRIDE {
+ PolicyTestBase::SetUp();
+
ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir_));
test_data_dir_ = test_data_dir_.AppendASCII("chrome")
.AppendASCII("test")
.AppendASCII("data")
.AppendASCII("policy")
.AppendASCII("gpo");
+
+ // Unknown components will be filtered out. Register their names with an
+ // invalid schema to avoid that.
+ ComponentMap components;
bartfab (slow) 2013/11/08 13:50:17 Nit: #include "chrome/browser/policy/schema_map.h"
Joao da Silva 2013/11/08 14:18:46 Done.
+ components["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = Schema();
+ components["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"] = Schema();
+ components["int"] = Schema();
+ components["merge"] = Schema();
+ components["string"] = Schema();
+ components["test"] = Schema();
+ schema_registry_.RegisterComponents(POLICY_DOMAIN_EXTENSIONS, components);
}
// AppliedGPOListProvider:
@@ -826,7 +843,8 @@ class PolicyLoaderWinTest : public PolicyTestBase,
PolicyLoaderWin loader(loop_.message_loop_proxy(),
&test_policy_definitions::kList, kTestPolicyKey,
this);
- scoped_ptr<PolicyBundle> loaded(loader.Load());
+ scoped_ptr<PolicyBundle> loaded(
+ loader.InitialLoad(schema_registry_.schema_map()));
return loaded->Equals(expected);
}

Powered by Google App Engine
This is Rietveld 408576698