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

Unified Diff: grit/format/policy_templates/writers/adm_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/adm_writer_unittest.py
===================================================================
--- grit/format/policy_templates/writers/adm_writer_unittest.py (revision 169)
+++ grit/format/policy_templates/writers/adm_writer_unittest.py (working copy)
@@ -552,6 +552,86 @@
''')
self.CompareOutputs(output, expected_output)
+ def testStringEnumListPolicy(self):
+ # Tests a policy group with a single policy of type 'string-enum-list'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'ListPolicy',
+ 'type': 'string-enum-list',
+ 'supported_on': ['chrome.win:8-'],
+ 'features': { 'can_be_recommended': True },
+ 'desc': """Description of list policy.
+With a newline.""",
+ 'items': [
+ {'name': 'ProxyServerDisabled', 'value': 'one',
+ 'caption': 'Option1'},
+ {'name': 'ProxyServerAutoDetect', 'value': 'two',
+ 'caption': 'Option2'},
+ ],
+ 'caption': 'Caption of list policy.',
+ 'label': 'Label of list policy.'
+ },
+ ],
+ 'placeholders': [],
+ 'messages': {
+ 'win_supported_winxpsp2': {
+ 'text': 'At least Windows 3.15', 'desc': 'blah'
+ },
+ 'doc_recommended': {
+ 'text': 'Recommended', 'desc': 'bleh'
+ }
+ },
+ }''')
+ output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+ expected_output = self.ConstructOutput(
+ ['MACHINE', 'USER'], '''
+ CATEGORY !!chromium
+ KEYNAME "Software\\Policies\\Chromium"
+
+ POLICY !!ListPolicy_Policy
+ #if version >= 4
+ SUPPORTED !!SUPPORTED_WINXPSP2
+ #endif
+ EXPLAIN !!ListPolicy_Explain
+
+ PART !!ListPolicy_Part LISTBOX
+ KEYNAME "Software\\Policies\\Chromium\\ListPolicy"
+ VALUEPREFIX ""
+ END PART
+ END POLICY
+
+ END CATEGORY
+
+ CATEGORY !!chromium_recommended
+ KEYNAME "Software\\Policies\\Chromium\\Recommended"
+
+ POLICY !!ListPolicy_Policy
+ #if version >= 4
+ SUPPORTED !!SUPPORTED_WINXPSP2
+ #endif
+ EXPLAIN !!ListPolicy_Explain
+
+ PART !!ListPolicy_Part LISTBOX
+ KEYNAME "Software\\Policies\\Chromium\\Recommended\\ListPolicy"
+ VALUEPREFIX ""
+ END PART
+ END POLICY
+
+ END CATEGORY
+
+
+''', '''[Strings]
+SUPPORTED_WINXPSP2="At least Windows 3.15"
+chromium="Chromium"
+chromium_recommended="Chromium - Recommended"
+ListPolicy_Policy="Caption of list policy."
+ListPolicy_Explain="Description of list policy.\\nWith a newline."
+ListPolicy_Part="Label of list policy."
+''')
+ self.CompareOutputs(output, expected_output)
+
def testDictionaryPolicy(self):
# Tests a policy group with a single policy of type 'dict'.
grd = self.PrepareTest('''
« no previous file with comments | « grit/format/policy_templates/writers/adm_writer.py ('k') | grit/format/policy_templates/writers/adml_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698