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

Unified Diff: components/policy/tools/template_writers/writers/json_writer_unittest.py

Issue 2653823006: Include 'external' policies in grit output (admx, adm, doc etc.) (Closed)
Patch Set: Whitespace fix Created 3 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/tools/template_writers/writers/json_writer_unittest.py
diff --git a/components/policy/tools/template_writers/writers/json_writer_unittest.py b/components/policy/tools/template_writers/writers/json_writer_unittest.py
index 46380946b7428b5e4b96ff5ccaa8028e69c4204b..a828dc3fed1d6ef7ec2769360c50505d86a9954a 100755
--- a/components/policy/tools/template_writers/writers/json_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/json_writer_unittest.py
@@ -358,6 +358,37 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'}')
self.CompareOutputs(output, expected_output)
+ def testExternalPolicy(self):
+ # Tests a policy group with a single policy of type 'external'.
+ example = {
+ "url": "https://example.com/avatar.jpg",
+ "hash": "deadbeef",
+ }
+ policy_json = '''
+ {
+ "policy_definitions": [
+ {
+ "name": "ExternalPolicy",
+ "type": "external",
+ "caption": "Example External Policy",
+ "desc": "Example External Policy",
+ "supported_on": ["chrome.linux:8-"],
+ "example_value": %s
+ },
+ ],
+ "placeholders": [],
+ "messages": {},
+ }''' % str(example)
+ output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
+ expected_output = (
+ TEMPLATE_HEADER +
+ ' // Example External Policy\n' +
+ HEADER_DELIMETER +
+ ' // Example External Policy\n\n'
+ ' //"ExternalPolicy": {"hash": "deadbeef", "url": "https://example.com/avatar.jpg"}\n\n'
+ '}')
+ self.CompareOutputs(output, expected_output)
+
def testNonSupportedPolicy(self):
# Tests a policy that is not supported on Linux, so it shouldn't
# be included in the JSON file.

Powered by Google App Engine
This is Rietveld 408576698