Chromium Code Reviews| Index: grit/format/policy_templates/writers/plist_writer_unittest.py |
| diff --git a/grit/format/policy_templates/writers/plist_writer_unittest.py b/grit/format/policy_templates/writers/plist_writer_unittest.py |
| index a9d146df9b9f0ab23c1c23bd6ad37699ff0fdc4e..33ff6c56bfce349cc2d4b63b01f804d8cf24d302 100644 |
| --- a/grit/format/policy_templates/writers/plist_writer_unittest.py |
| +++ b/grit/format/policy_templates/writers/plist_writer_unittest.py |
| @@ -165,6 +165,127 @@ class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon): |
| </array>''') |
| self.assertEquals(output.strip(), expected_output.strip()) |
| + def testListPolicy(self): |
| + # Tests a policy group with a single policy of type 'list'. |
| + grd = self.PrepareTest(''' |
| + { |
| + 'policy_definitions': [ |
| + { |
| + 'name': 'ListGroup', |
| + 'type': 'group', |
| + 'desc': '', |
| + 'caption': '', |
| + 'policies': [{ |
| + 'name': 'ListPolicy', |
| + 'type': 'list', |
| + 'schema': { |
| + 'type': 'array', |
| + 'items': { 'type': 'string' }, |
| + }, |
| + 'supported_on': ['chrome.mac:8-'], |
| + 'desc': '', |
| + 'caption': '', |
| + }], |
| + }, |
| + ], |
| + 'placeholders': [], |
| + 'messages': {}, |
| + }''') |
| + output = self.GetOutput( |
| + grd, |
| + 'fr', |
| + {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'}, |
| + 'plist', |
| + 'en') |
| + expected_output = self._GetExpectedOutputs( |
| + 'Chromium', 'com.example.Test', '''<array> |
| + <dict> |
| + <key>pfm_name</key> |
| + <string>ListPolicy</string> |
| + <key>pfm_description</key> |
| + <string/> |
| + <key>pfm_title</key> |
| + <string/> |
| + <key>pfm_targets</key> |
| + <array> |
| + <string>user-managed</string> |
| + </array> |
| + <key>pfm_type</key> |
| + <string>array</string> |
| + <key>pfm_subkeys</key> |
| + <array> |
| + <dict> |
| + <key>pfm_type</key> |
| + <string>string</string> |
| + </dict> |
| + </array> |
| + </dict> |
| + </array>''') |
| + self.assertEquals(output.strip(), expected_output.strip()) |
| + |
| + def testStringEnumListPolicy(self): |
| + # Tests a policy group with a single policy of type 'list'. |
|
Joao da Silva
2014/06/25 16:46:56
string-enum-list
Andrew T Wilson (Slow)
2014/06/26 08:08:56
Done.
|
| + grd = self.PrepareTest(''' |
| + { |
| + 'policy_definitions': [ |
| + { |
| + 'name': 'ListGroup', |
| + 'type': 'group', |
| + 'desc': '', |
| + 'caption': '', |
| + 'policies': [{ |
| + 'name': 'ListPolicy', |
| + 'type': 'string-enum-list', |
| + 'schema': { |
| + 'type': 'array', |
| + 'items': { 'type': 'string' }, |
| + }, |
| + 'items': [ |
| + {'name': 'ProxyServerDisabled', 'value': 'one', 'caption': ''}, |
| + {'name': 'ProxyServerAutoDetect', 'value': 'two', 'caption': ''}, |
| + ], |
| + 'supported_on': ['chrome.mac:8-'], |
| + 'supported_on': ['chrome.mac:8-'], |
| + 'desc': '', |
| + 'caption': '', |
| + }], |
| + }, |
| + ], |
| + 'placeholders': [], |
| + 'messages': {}, |
| + }''') |
| + output = self.GetOutput( |
| + grd, |
| + 'fr', |
| + {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'}, |
| + 'plist', |
| + 'en') |
| + expected_output = self._GetExpectedOutputs( |
| + 'Chromium', 'com.example.Test', '''<array> |
| + <dict> |
| + <key>pfm_name</key> |
| + <string>ListPolicy</string> |
| + <key>pfm_description</key> |
| + <string/> |
| + <key>pfm_title</key> |
| + <string/> |
| + <key>pfm_targets</key> |
| + <array> |
| + <string>user-managed</string> |
| + </array> |
| + <key>pfm_type</key> |
| + <string>array</string> |
| + <key>pfm_subkeys</key> |
| + <array> |
| + <dict> |
| + <key>pfm_type</key> |
| + <string>string</string> |
|
Joao da Silva
2014/06/25 16:46:57
See the int-enum example below: it's possible to e
Andrew T Wilson (Slow)
2014/06/26 08:08:56
I'm trying really hard not to have to actually tes
Joao da Silva
2014/06/26 11:34:07
That's cool, I can do the testing for the followup
|
| + </dict> |
| + </array> |
| + </dict> |
| + </array>''') |
| + self.assertEquals(output.strip(), expected_output.strip()) |
| + |
| def testIntPolicy(self): |
| # Tests a policy group with a single policy of type 'int'. |
| grd = self.PrepareTest(''' |