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

Unified Diff: chrome/browser/policy/generate_policy_source_unittest.cc

Issue 58313002: Removed the PolicyDefinitionList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-10-use-registry
Patch Set: rebase Created 7 years, 1 month 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/policy/generate_policy_source_unittest.cc
diff --git a/chrome/browser/policy/generate_policy_source_unittest.cc b/chrome/browser/policy/generate_policy_source_unittest.cc
index c82341036e5aa7302eb58c6a9a6681941d9f6891..e0e5ee44c462072b41bd88a15b81421a3ad63766 100644
--- a/chrome/browser/policy/generate_policy_source_unittest.cc
+++ b/chrome/browser/policy/generate_policy_source_unittest.cc
@@ -6,6 +6,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
+#include "build/build_config.h"
+#include "components/policy/core/common/policy_details.h"
#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -55,6 +57,14 @@ TEST(GeneratePolicySource, ChromeSchemaData) {
ASSERT_TRUE(subschema.GetProperty(key::kProxyPacUrl).valid());
ASSERT_TRUE(subschema.GetProperty(key::kProxyBypassList).valid());
+ // Verify that all the Chrome policies are there.
+ for (Schema::Iterator it = schema.GetPropertiesIterator();
+ !it.IsAtEnd(); it.Advance()) {
+ EXPECT_TRUE(it.key());
+ EXPECT_FALSE(std::string(it.key()).empty());
+ EXPECT_TRUE(GetChromePolicyDetails(it.key()));
+ }
+
// The properties are iterated in order.
const char* kExpectedProperties[] = {
key::kProxyBypassList,
@@ -75,4 +85,39 @@ TEST(GeneratePolicySource, ChromeSchemaData) {
EXPECT_TRUE(*next == NULL);
}
+TEST(GeneratePolicySource, PolicyDetails) {
+ EXPECT_FALSE(GetChromePolicyDetails(""));
+ EXPECT_FALSE(GetChromePolicyDetails("no such policy"));
+ EXPECT_FALSE(GetChromePolicyDetails("AlternateErrorPagesEnable"));
+ EXPECT_FALSE(GetChromePolicyDetails("alternateErrorPagesEnabled"));
+ EXPECT_FALSE(GetChromePolicyDetails("AAlternateErrorPagesEnabled"));
+
+ const PolicyDetails* details =
+ GetChromePolicyDetails(key::kAlternateErrorPagesEnabled);
+ ASSERT_TRUE(details);
+ EXPECT_FALSE(details->is_deprecated);
+ EXPECT_FALSE(details->is_device_policy);
+ EXPECT_EQ(5, details->id);
+ EXPECT_EQ(0u, details->max_external_data_size);
+
+ details = GetChromePolicyDetails(key::kJavascriptEnabled);
+ ASSERT_TRUE(details);
+ EXPECT_TRUE(details->is_deprecated);
+ EXPECT_FALSE(details->is_device_policy);
+ EXPECT_EQ(9, details->id);
+ EXPECT_EQ(0u, details->max_external_data_size);
+
+#if defined(OS_CHROMEOS)
+ details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate);
+ ASSERT_TRUE(details);
+ EXPECT_FALSE(details->is_deprecated);
+ EXPECT_TRUE(details->is_device_policy);
+ EXPECT_EQ(90, details->id);
+ EXPECT_EQ(0u, details->max_external_data_size);
+#endif
+
+ // TODO(bartfab): add a test that verifies a max_external_data_size larger
+ // than 0, once a type 'external' policy is added.
+}
+
} // namespace policy
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_test.cc ('k') | chrome/browser/policy/policy_loader_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698