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

Unified Diff: grit/format/policy_templates/writers/plist_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_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('''
« no previous file with comments | « grit/format/policy_templates/writers/plist_writer.py ('k') | grit/format/policy_templates/writers/reg_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698