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

Unified Diff: components/policy/core/common/schema_map_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: components/policy/core/common/schema_map_unittest.cc
diff --git a/components/policy/core/common/schema_map_unittest.cc b/components/policy/core/common/schema_map_unittest.cc
index ef7e336c9b6f810b5f73b2683a91c5246e7dab25..e19a70d383f5f63b9e0b507f71636fa17ede258b 100644
--- a/components/policy/core/common/schema_map_unittest.cc
+++ b/components/policy/core/common/schema_map_unittest.cc
@@ -10,6 +10,7 @@
#include "components/policy/core/common/external_data_manager.h"
#include "components/policy/core/common/policy_bundle.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 "testing/gtest/include/gtest/gtest.h"
@@ -141,6 +142,7 @@ TEST_F(SchemaMapTest, FilterBundle) {
expected_bundle.Get(chrome_ns).Set("ChromePolicy",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value"),
NULL);
bundle.CopyFrom(expected_bundle);
@@ -150,6 +152,7 @@ TEST_F(SchemaMapTest, FilterBundle) {
bundle.Get(another_extension_ns).Set("AnotherExtensionPolicy",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value"),
NULL);
schema_map->FilterBundle(&bundle);
@@ -161,32 +164,37 @@ TEST_F(SchemaMapTest, FilterBundle) {
list.AppendString("a");
list.AppendString("b");
map.Set("list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- list.DeepCopy(), NULL);
+ POLICY_SOURCE_CLOUD, list.DeepCopy(), nullptr);
map.Set("boolean",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
map.Set("integer",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(1),
NULL);
map.Set("null", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateNullValue().release(), NULL);
+ POLICY_SOURCE_CLOUD, base::Value::CreateNullValue().release(),
+ nullptr);
map.Set("double",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(1.2),
NULL);
base::DictionaryValue dict;
dict.SetString("a", "b");
dict.SetInteger("b", 2);
map.Set("object", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- dict.DeepCopy(), NULL);
+ POLICY_SOURCE_CLOUD, dict.DeepCopy(), nullptr);
map.Set("string",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value"),
NULL);
@@ -194,6 +202,7 @@ TEST_F(SchemaMapTest, FilterBundle) {
bundle.Get(extension_ns).Set("Unexpected",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("to-be-removed"),
NULL);
@@ -206,35 +215,41 @@ TEST_F(SchemaMapTest, FilterBundle) {
badmap.Set("list",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
badmap.Set("boolean",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(0),
NULL);
badmap.Set("integer",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
badmap.Set("null",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
badmap.Set("double",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
badmap.Set("object",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
badmap.Set("string", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- NULL,
+ POLICY_SOURCE_CLOUD, nullptr,
new ExternalDataFetcher(base::WeakPtr<ExternalDataManager>(),
std::string()));
@@ -266,6 +281,7 @@ TEST_F(SchemaMapTest, LegacyComponents) {
bundle.Get(extension_ns).Set("String",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value 1"),
NULL);
@@ -274,6 +290,7 @@ TEST_F(SchemaMapTest, LegacyComponents) {
bundle.Get(chrome_ns).Set("ChromePolicy",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value 3"),
NULL);
@@ -285,6 +302,7 @@ TEST_F(SchemaMapTest, LegacyComponents) {
bundle.Get(without_schema_ns).Set("Schemaless",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value 2"),
NULL);
@@ -292,6 +310,7 @@ TEST_F(SchemaMapTest, LegacyComponents) {
bundle.Get(extension_ns).Set("Surprise",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value 4"),
NULL);
@@ -300,6 +319,7 @@ TEST_F(SchemaMapTest, LegacyComponents) {
bundle.Get(unknown_ns).Set("Surprise",
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("value 5"),
NULL);

Powered by Google App Engine
This is Rietveld 408576698