| Index: grit/format/policy_templates/writers/plist_writer_unittest.py
|
| ===================================================================
|
| --- grit/format/policy_templates/writers/plist_writer_unittest.py (revision 169)
|
| +++ grit/format/policy_templates/writers/plist_writer_unittest.py (working copy)
|
| @@ -165,6 +165,127 @@
|
| </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 'string-enum-list'.
|
| + 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>
|
| + </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('''
|
|
|