Chromium Code Reviews| 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); |