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

Unified Diff: tools/grit/grit/format/policy_templates/writers/adm_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/adm_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
index b823aaef86116992447d77657140b82883a1cc74..e888c73137824e8c62cdf7f8dd969029e0b45e80 100644
--- a/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
@@ -44,11 +44,12 @@ class AdmWriterUnittest(writer_unittest_common.WriterUnittestCommon):
{
'policy_definitions': [],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least "Windows 3.11</message>
- </messages>
- ''' )
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least "Windows 3.11', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_chromium': '1',}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!chromium
@@ -69,17 +70,18 @@ chromium="Chromium"'''
{
'name': 'MainPolicy',
'type': 'main',
- 'supported_on': ['chrome.win:8-']
+ 'supported_on': ['chrome.win:8-'],
+ 'caption': 'Caption of main.',
+ 'desc': 'Description of main.',
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_MAINPOLICY_CAPTION">Caption of main.</message>
- <message name="IDS_POLICY_MAINPOLICY_DESC">Description of main.</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.12</message>
- </messages>
- ''' )
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.12', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!google
@@ -115,18 +117,19 @@ MainPolicy_Explain="Description of main."'''
{
'name': 'StringPolicy',
'type': 'string',
- 'supported_on': ['chrome.win:8-']
+ 'supported_on': ['chrome.win:8-'],
+ 'desc': """Description of group.
+With a newline.""",
+ 'caption': 'Caption of policy.',
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_STRINGPOLICY_CAPTION">Caption of policy.</message>
- <message name="IDS_POLICY_STRINGPOLICY_DESC">Description of group.
-With a newline.</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.13</message>
- </messages>
- ''' )
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.13', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!chromium
@@ -163,22 +166,29 @@ StringPolicy_Part="Caption of policy."
'name': 'EnumPolicy',
'type': 'enum',
'items': [
- {'name': 'ProxyServerDisabled', 'value': '0'},
- {'name': 'ProxyServerAutoDetect', 'value': '1'},
+ {
+ 'name': 'ProxyServerDisabled',
+ 'value': '0',
+ 'caption': 'Option1',
+ },
+ {
+ 'name': 'ProxyServerAutoDetect',
+ 'value': '1',
+ 'caption': 'Option2',
+ },
],
+ 'desc': 'Description of policy.',
+ 'caption': 'Caption of policy.',
'supported_on': ['chrome.win:8-']
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_ENUMPOLICY_CAPTION">Caption of policy.</message>
- <message name="IDS_POLICY_ENUMPOLICY_DESC">Description of policy.</message>
- <message name="IDS_POLICY_ENUM_PROXYSERVERDISABLED_CAPTION">Option1</message>
- <message name="IDS_POLICY_ENUM_PROXYSERVERAUTODETECT_CAPTION">Option2</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.14</message>
- </messages>
- ''' )
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.14', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!google
@@ -223,19 +233,20 @@ ProxyServerAutoDetect_DropDown="Option2"
{
'name': 'ListPolicy',
'type': 'list',
- 'supported_on': ['chrome.win:8-']
+ 'supported_on': ['chrome.win:8-'],
+ 'desc': """Description of list policy.
+With a newline.""",
+ 'caption': 'Caption of list policy.',
+ 'label': 'Label of list policy.'
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_LISTPOLICY_DESC">Description of list policy.
-With a newline.</message>
- <message name="IDS_POLICY_LISTPOLICY_CAPTION">Caption of list policy.</message>
- <message name="IDS_POLICY_LISTPOLICY_LABEL">Value caption of list policy.</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.15</message>
- </messages>
- ''')
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.15', 'desc': 'blah'
+ }
+ },
+ }''')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!chromium
@@ -260,7 +271,7 @@ SUPPORTED_WINXPSP2="At least Windows 3.15"
chromium="Chromium"
ListPolicy_Policy="Caption of list policy."
ListPolicy_Explain="Description of list policy.\\nWith a newline."
-ListPolicy_Part="Value caption of list policy."
+ListPolicy_Part="Label of list policy."
'''
self.CompareOutputs(output, expected_output)
@@ -276,20 +287,21 @@ ListPolicy_Part="Value caption of list policy."
'policies': [{
'name': 'NonWinPolicy',
'type': 'list',
- 'supported_on': ['chrome.linux:8-', 'chrome.mac:8-']
+ 'supported_on': ['chrome.linux:8-', 'chrome.mac:8-'],
+ 'caption': 'Caption of list policy.',
+ 'desc': 'Desc of list policy.',
}],
+ 'caption': 'Group caption.',
+ 'desc': 'Group description.',
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_NONWINGROUP_CAPTION">Group caption.</message>
- <message name="IDS_POLICY_NONWINGROUP_DESC">Group description.</message>
- <message name="IDS_POLICY_NONWINPOLICY_CAPTION">Caption of list policy.</message>
- <message name="IDS_POLICY_NONWINPOLICY_DESC">Desc of list policy.</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.16</message>
- </messages>
- ''')
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.16', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!chromium
@@ -311,31 +323,32 @@ chromium="Chromium"
{
'name': 'Group1',
'type': 'group',
+ 'desc': 'Description of group.',
+ 'caption': 'Caption of group.',
'policies': [{
'name': 'Policy1',
'type': 'list',
- 'supported_on': ['chrome.win:8-']
+ 'supported_on': ['chrome.win:8-'],
+ 'caption': 'Caption of policy1.',
+ 'desc': """Description of policy1.
+With a newline."""
},{
'name': 'Policy2',
'type': 'string',
- 'supported_on': ['chrome.win:8-']
+ 'supported_on': ['chrome.win:8-'],
+ 'caption': 'Caption of policy2.',
+ 'desc': """Description of policy2.
+With a newline."""
}],
},
],
'placeholders': [],
- }''', '''
- <messages>
- <message name="IDS_POLICY_GROUP1_CAPTION">Caption of group.</message>
- <message name="IDS_POLICY_GROUP1_DESC">Description of group.</message>
- <message name="IDS_POLICY_POLICY1_DESC">Description of policy1.
-With a newline.</message>
- <message name="IDS_POLICY_POLICY2_DESC">Description of policy2.
-With a newline.</message>
- <message name="IDS_POLICY_POLICY1_CAPTION">Caption of policy1.</message>
- <message name="IDS_POLICY_POLICY2_CAPTION">Caption of policy2.</message>
- <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.16</message>
- </messages>
- ''')
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.16', 'desc': 'blah'
+ }
+ }
+ }''')
output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
expected_output = '''CLASS MACHINE
CATEGORY !!chromium

Powered by Google App Engine
This is Rietveld 408576698