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

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

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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: 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 0f407e59f89445eb395c0507643cfff2413ee82f..8fec9885e5bddc63f4b2b7cee99ff7debe5cb1a0 100644
--- a/components/policy/core/common/configuration_policy_provider_test.cc
+++ b/components/policy/core/common/configuration_policy_provider_test.cc
@@ -146,8 +146,9 @@ bool PolicyTestBase::RegisterSchema(const PolicyNamespace& ns,
}
PolicyProviderTestHarness::PolicyProviderTestHarness(PolicyLevel level,
- PolicyScope scope)
- : level_(level), scope_(scope) {}
+ PolicyScope scope,
+ PolicySource source)
+ : level_(level), scope_(scope), source_(source) {}
PolicyProviderTestHarness::~PolicyProviderTestHarness() {}
@@ -159,6 +160,10 @@ PolicyScope PolicyProviderTestHarness::policy_scope() const {
return scope_;
}
+PolicySource PolicyProviderTestHarness::policy_source() const {
+ return source_;
+}
+
void PolicyProviderTestHarness::Install3rdPartyPolicy(
const base::DictionaryValue* policies) {
FAIL();
@@ -221,11 +226,12 @@ void ConfigurationPolicyProviderTest::CheckValue(
loop_.RunUntilIdle();
PolicyBundle expected_bundle;
expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
- .Set(policy_name,
- test_harness_->policy_level(),
- test_harness_->policy_scope(),
- expected_value.DeepCopy(),
- NULL);
+ .SetWithSource(policy_name,
+ test_harness_->policy_level(),
+ test_harness_->policy_scope(),
+ expected_value.DeepCopy(),
+ NULL,
bartfab (slow) 2015/09/14 14:42:27 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:05 Done.
+ test_harness_->policy_source());
EXPECT_TRUE(provider_->policies().Equals(expected_bundle));
// TODO(joaodasilva): set the policy in the POLICY_DOMAIN_EXTENSIONS too,
// and extend the |expected_bundle|, once all providers are ready.
@@ -337,11 +343,12 @@ TEST_P(ConfigurationPolicyProviderTest, RefreshPolicies) {
Mock::VerifyAndClearExpectations(&observer);
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
- .Set(test_keys::kKeyString,
- test_harness_->policy_level(),
- test_harness_->policy_scope(),
- new base::StringValue("value"),
- NULL);
+ .SetWithSource(test_keys::kKeyString,
+ test_harness_->policy_level(),
+ test_harness_->policy_scope(),
+ new base::StringValue("value"),
+ NULL,
bartfab (slow) 2015/09/14 14:42:27 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:05 Done.
+ test_harness_->policy_source());
EXPECT_TRUE(provider_->policies().Equals(bundle));
provider_->RemoveObserver(&observer);
}
@@ -389,11 +396,12 @@ TEST_P(Configuration3rdPartyPolicyProviderTest, Load3rdParty) {
loop_.RunUntilIdle();
PolicyMap expected_policy;
- expected_policy.Set(test_keys::kKeyDictionary,
- test_harness_->policy_level(),
- test_harness_->policy_scope(),
- policy_dict.DeepCopy(),
- NULL);
+ expected_policy.SetWithSource(test_keys::kKeyDictionary,
+ test_harness_->policy_level(),
+ test_harness_->policy_scope(),
+ policy_dict.DeepCopy(),
+ NULL,
bartfab (slow) 2015/09/14 14:42:27 Nit: s/NULL/nullptr/
fhorschig 2015/09/16 13:52:05 Done.
+ test_harness_->policy_source());
PolicyBundle expected_bundle;
expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.CopyFrom(expected_policy);
@@ -401,6 +409,7 @@ TEST_P(Configuration3rdPartyPolicyProviderTest, Load3rdParty) {
expected_policy.LoadFrom(&policy_dict,
test_harness_->policy_level(),
test_harness_->policy_scope());
+ expected_policy.ApplySourceToEntries(test_harness_->policy_source());
bartfab (slow) 2015/09/14 14:42:27 If LoadFrom() is able to set the level and scope,
fhorschig 2015/09/16 13:52:05 Done.
expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
.CopyFrom(expected_policy);

Powered by Google App Engine
This is Rietveld 408576698