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

Unified Diff: components/policy/core/common/async_policy_provider_unittest.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: Increased ID range for Messages. 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/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.

Powered by Google App Engine
This is Rietveld 408576698