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

Unified Diff: grit/format/policy_templates/writers/plist_strings_writer_unittest.py

Issue 347293003: Added support for string-enum-list. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 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: grit/format/policy_templates/writers/plist_strings_writer_unittest.py
===================================================================
--- grit/format/policy_templates/writers/plist_strings_writer_unittest.py (revision 169)
+++ grit/format/policy_templates/writers/plist_strings_writer_unittest.py (working copy)
@@ -127,6 +127,111 @@
'"Description of policy.\\nWith a newline.";')
self.assertEquals(output.strip(), expected_output.strip())
+ def testStringListPolicy(self):
+ # Tests a policy group with a single policy of type 'list'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'ListGroup',
+ 'type': 'group',
+ 'caption': '',
+ 'desc': '',
+ 'policies': [{
+ 'name': 'ListPolicy',
+ 'type': 'list',
+ 'caption': 'Caption of policy.',
+ 'desc': """Description of policy.
+With a newline.""",
+ 'schema': {
+ 'type': 'array',
+ 'items': { 'type': 'string' },
+ },
+ 'supported_on': ['chrome.mac:8-'],
+ }],
+ },
+ ],
+ 'placeholders': [],
+ 'messages': {
+ 'mac_chrome_preferences': {
+ 'text': 'Preferences of $1',
+ 'desc': 'blah'
+ }
+ }
+ }''')
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
+ 'plist_strings',
+ 'en')
+ expected_output = (
+ 'Chromium.pfm_title = "Chromium";\n'
+ 'Chromium.pfm_description = "Preferences of Chromium";\n'
+ 'ListPolicy.pfm_title = "Caption of policy.";\n'
+ 'ListPolicy.pfm_description = '
+ '"Description of policy.\\nWith a newline.";')
+ self.assertEquals(output.strip(), expected_output.strip())
+
+ def testStringEnumListPolicy(self):
+ # Tests a policy group with a single policy of type 'string-enum-list'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'EnumGroup',
+ 'type': 'group',
+ 'caption': '',
+ 'desc': '',
+ 'policies': [{
+ 'name': 'EnumPolicy',
+ 'type': 'string-enum-list',
+ 'caption': 'Caption of policy.',
+ 'desc': """Description of policy.
+With a newline.""",
+ 'schema': {
+ 'type': 'array',
+ 'items': { 'type': 'string' },
+ },
+ 'items': [
+ {
+ 'name': 'ProxyServerDisabled',
+ 'value': 'one',
+ 'caption': 'Option1'
+ },
+ {
+ 'name': 'ProxyServerAutoDetect',
+ 'value': 'two',
+ 'caption': 'Option2'
+ },
+ ],
+ 'supported_on': ['chrome.mac:8-'],
+ }],
+ },
+ ],
+ 'placeholders': [],
+ 'messages': {
+ 'mac_chrome_preferences': {
+ 'text': 'Preferences of $1',
+ 'desc': 'blah'
+ }
+ }
+ }''')
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
+ 'plist_strings',
+ 'en')
+ expected_output = (
+ 'Chromium.pfm_title = "Chromium";\n'
+ 'Chromium.pfm_description = "Preferences of Chromium";\n'
+ 'EnumPolicy.pfm_title = "Caption of policy.";\n'
+ 'EnumPolicy.pfm_description = '
+ '"one - Option1\\ntwo - Option2\\n'
+ 'Description of policy.\\nWith a newline.";')
+ self.assertEquals(output.strip(), expected_output.strip())
+
def testIntEnumPolicy(self):
# Tests a policy group with a single policy of type 'int-enum'.
grd = self.PrepareTest('''
« no previous file with comments | « grit/format/policy_templates/writers/plist_strings_writer.py ('k') | grit/format/policy_templates/writers/plist_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698