Chromium Code Reviews| Index: components/policy/core/common/async_policy_provider_unittest.cc |
| diff --git a/components/policy/core/common/async_policy_provider_unittest.cc b/components/policy/core/common/async_policy_provider_unittest.cc |
| index 587d693c341fa546423e1d45efebbf57f731c953..ebefd6f06149c12e79e900f65423b051dfa170c9 100644 |
| --- a/components/policy/core/common/async_policy_provider_unittest.cc |
| +++ b/components/policy/core/common/async_policy_provider_unittest.cc |
| @@ -36,6 +36,18 @@ void SetPolicy(PolicyBundle* bundle, |
| NULL); |
| } |
| +void SetPlatformPolicy(PolicyBundle* bundle, |
|
Thiemo Nagel
2015/09/04 20:15:53
Is it really necessary to have a separate function
fhorschig
2015/09/07 14:09:34
No. Removed.
|
| + const std::string& name, |
| + const std::string& value) { |
| + bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| + .SetWithSource(name, |
| + POLICY_LEVEL_MANDATORY, |
| + POLICY_SCOPE_USER, |
| + new base::StringValue(value), |
| + NULL, |
| + POLICY_SOURCE_PLATFORM); |
| +} |
| + |
| class MockPolicyLoader : public AsyncPolicyLoader { |
| public: |
| explicit MockPolicyLoader( |
| @@ -127,7 +139,7 @@ void AsyncPolicyProviderTest::TearDown() { |
| TEST_F(AsyncPolicyProviderTest, RefreshPolicies) { |
| PolicyBundle refreshed_bundle; |
| - SetPolicy(&refreshed_bundle, "policy", "refreshed"); |
| + SetPlatformPolicy(&refreshed_bundle, "policy", "refreshed"); |
| EXPECT_CALL(*loader_, MockLoad()).WillOnce(Return(&refreshed_bundle)); |
| MockConfigurationPolicyObserver observer; |
| @@ -142,7 +154,7 @@ TEST_F(AsyncPolicyProviderTest, RefreshPolicies) { |
| TEST_F(AsyncPolicyProviderTest, RefreshPoliciesTwice) { |
| PolicyBundle refreshed_bundle; |
| - SetPolicy(&refreshed_bundle, "policy", "refreshed"); |
| + SetPlatformPolicy(&refreshed_bundle, "policy", "refreshed"); |
| EXPECT_CALL(*loader_, MockLoad()).WillRepeatedly(Return(&refreshed_bundle)); |
| MockConfigurationPolicyObserver observer; |
| @@ -167,9 +179,9 @@ TEST_F(AsyncPolicyProviderTest, RefreshPoliciesTwice) { |
| TEST_F(AsyncPolicyProviderTest, RefreshPoliciesDuringReload) { |
| PolicyBundle reloaded_bundle; |
| - SetPolicy(&reloaded_bundle, "policy", "reloaded"); |
| + SetPlatformPolicy(&reloaded_bundle, "policy", "reloaded"); |
| PolicyBundle refreshed_bundle; |
| - SetPolicy(&refreshed_bundle, "policy", "refreshed"); |
| + SetPlatformPolicy(&refreshed_bundle, "policy", "refreshed"); |
| Sequence load_sequence; |
| // Reload. |