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

Unified Diff: chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_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: Fixed another test. 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: chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc
index b654188ead171425120fd340481997569bfbd995..a5691b8bbadad0d519d5d91316f5049e088b856c 100644
--- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc
@@ -14,6 +14,7 @@
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -61,6 +62,7 @@ TEST_F(ScreenMagnifierPolicyHandlerTest, Disabled) {
policy_.Set(key::kScreenMagnifierType,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(0),
NULL);
handler_.ApplyPolicySettings(policy_, &prefs_);
@@ -81,6 +83,7 @@ TEST_F(ScreenMagnifierPolicyHandlerTest, Enabled) {
policy_.Set(key::kScreenMagnifierType,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(1),
NULL);
handler_.ApplyPolicySettings(policy_, &prefs_);
@@ -109,6 +112,7 @@ TEST(ExternalDataPolicyHandlerTest, WrongType) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
PolicyErrorMap errors;
@@ -124,6 +128,7 @@ TEST(ExternalDataPolicyHandlerTest, MissingURL) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict.release(),
NULL);
PolicyErrorMap errors;
@@ -140,6 +145,7 @@ TEST(ExternalDataPolicyHandlerTest, InvalidURL) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict.release(),
NULL);
PolicyErrorMap errors;
@@ -155,6 +161,7 @@ TEST(ExternalDataPolicyHandlerTest, MissingHash) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict.release(),
NULL);
PolicyErrorMap errors;
@@ -171,6 +178,7 @@ TEST(ExternalDataPolicyHandlerTest, InvalidHash) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict.release(),
NULL);
PolicyErrorMap errors;
@@ -189,6 +197,7 @@ TEST(ExternalDataPolicyHandlerTest, Valid) {
policy_map.Set(key::kUserAvatarImage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict.release(),
NULL);
PolicyErrorMap errors;
@@ -249,6 +258,7 @@ TEST(NetworkConfigurationPolicyHandlerTest, ValidONC) {
policy_map.Set(key::kOpenNetworkConfiguration,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kTestONC),
NULL);
scoped_ptr<NetworkConfigurationPolicyHandler> handler(
@@ -263,6 +273,7 @@ TEST(NetworkConfigurationPolicyHandlerTest, WrongType) {
policy_map.Set(key::kOpenNetworkConfiguration,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
scoped_ptr<NetworkConfigurationPolicyHandler> handler(
@@ -278,6 +289,7 @@ TEST(NetworkConfigurationPolicyHandlerTest, JSONParseError) {
policy_map.Set(key::kOpenNetworkConfiguration,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kTestONC),
NULL);
scoped_ptr<NetworkConfigurationPolicyHandler> handler(
@@ -306,6 +318,7 @@ TEST(NetworkConfigurationPolicyHandlerTest, Sanitization) {
policy_map.Set(key::kOpenNetworkConfiguration,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kTestONC),
NULL);
scoped_ptr<NetworkConfigurationPolicyHandler> handler(
@@ -330,7 +343,8 @@ TEST(PinnedLauncherAppsPolicyHandler, PrefTranslation) {
PinnedLauncherAppsPolicyHandler handler;
policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, list.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, list.DeepCopy(),
+ nullptr);
handler.ApplyPolicySettings(policy_map, &prefs);
EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value));
@@ -341,7 +355,8 @@ TEST(PinnedLauncherAppsPolicyHandler, PrefTranslation) {
expected_pinned_apps.Append(entry1_dict);
list.Append(entry1.DeepCopy());
policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, list.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, list.DeepCopy(),
+ nullptr);
prefs.Clear();
handler.ApplyPolicySettings(policy_map, &prefs);
EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
@@ -361,6 +376,7 @@ TEST_F(LoginScreenPowerManagementPolicyHandlerTest, ValidPolicy) {
policy_map.Set(
key::kDeviceLoginScreenPowerManagement, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
base::JSONReader::Read(kLoginScreenPowerManagementPolicy).release(),
NULL);
LoginScreenPowerManagementPolicyHandler handler(chrome_schema_);
@@ -374,6 +390,7 @@ TEST_F(LoginScreenPowerManagementPolicyHandlerTest, WrongType) {
policy_map.Set(key::kDeviceLoginScreenPowerManagement,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
LoginScreenPowerManagementPolicyHandler handler(chrome_schema_);

Powered by Google App Engine
This is Rietveld 408576698