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

Unified Diff: components/policy/core/common/config_dir_policy_loader_unittest.cc

Issue 1824743002: Drop non-user policy in ConfigDirPolicyLoader on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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/config_dir_policy_loader_unittest.cc
diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc
index dfa12b26d67a2f05888ff1c4dde41659a10a2160..99ae69ab71037eba0b7e1eb8e4f4a2d7cb5830ff 100644
--- a/components/policy/core/common/config_dir_policy_loader_unittest.cc
+++ b/components/policy/core/common/config_dir_policy_loader_unittest.cc
@@ -21,6 +21,111 @@
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
+// Use real existing policies as samples because ConfigDirPolicyLoader does
+// basic verification at load time. These constants are specific to
+// ConfigDirPolicyLoader and thus are hidden in an anonymous namespace. (They
+// cannot be applied generally because Windows tests depend on reading GPO
+// sample files containing hard-coded policy names.)
+namespace {
+
+const char kKeyString[] = "HomepageLocation";
+const char kKeyBoolean[] = "HomepageIsNewTabPage";
+const char kKeyInteger[] = "NetworkPredictionOptions";
+const char kKeyStringList[] = "DisabledSchemes";
+const char kKeyDictionary[] = "ProxySettings";
+
+const char kTestChromeSchema[] =
+ "{"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"HomepageLocation\": { \"type\": \"string\" },"
+ " \"HomepageIsNewTabPage\": { \"type\": \"boolean\" },"
+ " \"NetworkPredictionOptions\": { \"type\": \"integer\" },"
+ " \"DisabledSchemes\": {"
+ " \"type\": \"array\","
+ " \"items\": { \"type\": \"string\" }"
+ " },"
+ " \"ProxySettings\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"bool\": { \"type\": \"boolean\" },"
+ " \"double\": { \"type\": \"number\" },"
+ " \"int\": { \"type\": \"integer\" },"
+ " \"string\": { \"type\": \"string\" },"
+ " \"array\": {"
+ " \"type\": \"array\","
+ " \"items\": { \"type\": \"string\" }"
+ " },"
+ " \"dictionary\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"sub\": { \"type\": \"string\" },"
+ " \"sublist\": {"
+ " \"type\": \"array\","
+ " \"items\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"aaa\": { \"type\": \"integer\" },"
+ " \"bbb\": { \"type\": \"integer\" },"
+ " \"ccc\": { \"type\": \"string\" },"
+ " \"ddd\": { \"type\": \"string\" }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " },"
+ " \"list\": {"
+ " \"type\": \"array\","
+ " \"items\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"subdictindex\": { \"type\": \"integer\" },"
+ " \"subdict\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"bool\": { \"type\": \"boolean\" },"
+ " \"double\": { \"type\": \"number\" },"
+ " \"int\": { \"type\": \"integer\" },"
+ " \"string\": { \"type\": \"string\" }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " },"
+ " \"dict\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"bool\": { \"type\": \"boolean\" },"
+ " \"double\": { \"type\": \"number\" },"
+ " \"int\": { \"type\": \"integer\" },"
+ " \"string\": { \"type\": \"string\" },"
+ " \"list\": {"
+ " \"type\": \"array\","
+ " \"items\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"subdictindex\": { \"type\": \"integer\" },"
+ " \"subdict\": {"
+ " \"type\": \"object\","
+ " \"properties\": {"
+ " \"bool\": { \"type\": \"boolean\" },"
+ " \"double\": { \"type\": \"number\" },"
+ " \"int\": { \"type\": \"integer\" },"
+ " \"string\": { \"type\": \"string\" }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ " }"
+ "}";
+
+} // anonymous namespace
+
namespace policy {
namespace {
@@ -76,7 +181,14 @@ TestHarness::TestHarness()
: PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
POLICY_SOURCE_PLATFORM),
- next_policy_file_index_(100) {}
+ next_policy_file_index_(100) {
+ key_string_ = kKeyString;
+ key_boolean_ = kKeyBoolean;
+ key_integer_ = kKeyInteger;
+ key_stringlist_ = kKeyStringList;
+ key_dictionary_ = kKeyDictionary;
+ test_schema_ = kTestChromeSchema;
+}
TestHarness::~TestHarness() {}

Powered by Google App Engine
This is Rietveld 408576698