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

Unified Diff: tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py

Issue 6134006: Integrate user strings into the JSON policy template file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 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: tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
index 744eeaa5d843c8de6e2a7b2ef611128cd45dddf8..691c1e6bd3c8f6c3cdd82dbec3cc85118c7807ff 100644
--- a/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
@@ -39,7 +39,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'{'
' "policy_definitions": [],'
' "placeholders": [],'
- '}', '<messages></messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_chromium': '1',}, 'json', 'en')
expected_output = '{\n}'
self.CompareOutputs(output, expected_output)
@@ -52,6 +53,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "MainPolicy",'
' "type": "main",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
' "example_value": True'
@@ -59,11 +62,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_MAINPOLICY_CAPTION"></message>'
- ' <message name="IDS_POLICY_MAINPOLICY_DESC"></message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'json', 'en')
expected_output = (
'{\n'
@@ -79,6 +79,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "StringPolicy",'
' "type": "string",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
' "example_value": "hello, world!"'
@@ -86,11 +88,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_STRINGPOLICY_CAPTION"></message>'
- ' <message name="IDS_POLICY_STRINGPOLICY_DESC"></message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
expected_output = (
'{\n'
@@ -106,9 +105,11 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "EnumPolicy",'
' "type": "enum",'
+ ' "caption": "",'
+ ' "desc": "",'
' "items": ['
- ' {"name": "ProxyServerDisabled", "value": 0},'
- ' {"name": "ProxyServerAutoDetect", "value": 1},'
+ ' {"name": "ProxyServerDisabled", "value": 0, "caption": ""},'
+ ' {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},'
' ],'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
@@ -117,15 +118,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_ENUMPOLICY_CAPTION"></message>'
- ' <message name="IDS_POLICY_ENUMPOLICY_DESC"></message>'
- ' <message name="IDS_POLICY_ENUM_PROXYSERVERDISABLED_CAPTION">'
- ' </message>'
- ' <message name="IDS_POLICY_ENUM_PROXYSERVERAUTODETECT_CAPTION">'
- ' </message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'json', 'en')
expected_output = (
'{\n'
@@ -141,6 +135,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "ListPolicy",'
' "type": "list",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
' "example_value": ["foo", "bar"]'
@@ -148,12 +144,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_LISTPOLICY_DESC"></message>'
- ' <message name="IDS_POLICY_LISTPOLICY_CAPTION"></message>'
- ' <message name="IDS_POLICY_LISTPOLICY_LABEL"></message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
expected_output = (
'{\n'
@@ -170,6 +162,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "NonLinuxPolicy",'
' "type": "list",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.mac:8-"],'
' "annotations": {'
' "example_value": ["a"]'
@@ -177,11 +171,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_NONLINUXPOLICY_CAPTION"></message>'
- ' <message name="IDS_POLICY_NONLINUXPOLICY_DESC"></message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
expected_output = '{\n}'
self.CompareOutputs(output, expected_output)
@@ -194,9 +185,13 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {'
' "name": "Group1",'
' "type": "group",'
+ ' "caption": "",'
+ ' "desc": "",'
' "policies": [{'
' "name": "Policy1",'
' "type": "list",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
' "example_value": ["a", "b"]'
@@ -204,6 +199,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },{'
' "name": "Policy2",'
' "type": "string",'
+ ' "caption": "",'
+ ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],'
' "annotations": {'
' "example_value": "c"'
@@ -212,15 +209,8 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' },'
' ],'
' "placeholders": [],'
- '}',
- '<messages>'
- ' <message name="IDS_POLICY_GROUP1_CAPTION"></message>'
- ' <message name="IDS_POLICY_GROUP1_DESC"></message>'
- ' <message name="IDS_POLICY_POLICY1_DESC"></message>'
- ' <message name="IDS_POLICY_POLICY2_DESC"></message>'
- ' <message name="IDS_POLICY_POLICY1_CAPTION"></message>'
- ' <message name="IDS_POLICY_POLICY2_CAPTION"></message>'
- '</messages>')
+ ' "messages": {},'
+ '}')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
expected_output = (
'{\n'

Powered by Google App Engine
This is Rietveld 408576698