Index: grit/format/policy_templates/writers/plist_strings_writer_unittest.py |
diff --git a/grit/format/policy_templates/writers/plist_strings_writer_unittest.py b/grit/format/policy_templates/writers/plist_strings_writer_unittest.py |
index 613a3cd65b5b2197937d3efef86ac936ce22b6cd..17fc85c62ca20dd736349e901725ea2637824ec6 100644 |
--- a/grit/format/policy_templates/writers/plist_strings_writer_unittest.py |
+++ b/grit/format/policy_templates/writers/plist_strings_writer_unittest.py |
@@ -127,6 +127,111 @@ With a newline.""", |
'"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(''' |