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

Unified Diff: tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py

Issue 5958014: Policy: Add ProxyMode and deprecate ProxyServerMode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: check final diff Created 9 years, 11 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: tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
index b823aaef86116992447d77657140b82883a1cc74..91d71b8dcffacffb5b7ed673fdc71929555e776f 100644
--- a/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py
@@ -154,17 +154,17 @@ StringPolicy_Part="Caption of policy."
'''
self.CompareOutputs(output, expected_output)
- def testEnumPolicy(self):
- # Tests a policy group with a single policy of type 'enum'.
+ def testIntEnumPolicy(self):
+ # Tests a policy group with a single policy of type 'int-enum'.
grd = self.PrepareTest('''
{
'policy_definitions': [
{
'name': 'EnumPolicy',
- 'type': 'enum',
+ 'type': 'int-enum',
'items': [
- {'name': 'ProxyServerDisabled', 'value': '0'},
- {'name': 'ProxyServerAutoDetect', 'value': '1'},
+ {'name': 'ProxyServerDisabled', 'value': 0},
+ {'name': 'ProxyServerAutoDetect', 'value': 1},
],
'supported_on': ['chrome.win:8-']
},
@@ -215,6 +215,67 @@ ProxyServerAutoDetect_DropDown="Option2"
'''
self.CompareOutputs(output, expected_output)
+ def testStringEnumPolicy(self):
+ # Tests a policy group with a single policy of type 'int-enum'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'EnumPolicy',
+ 'type': 'string-enum',
+ 'items': [
+ {'name': 'ProxyServerDisabled', 'value': 'one'},
+ {'name': 'ProxyServerAutoDetect', 'value': 'two'},
+ ],
+ 'supported_on': ['chrome.win:8-']
+ },
+ ],
+ 'placeholders': [],
+ }''', '''
+ <messages>
+ <message name="IDS_POLICY_ENUMPOLICY_CAPTION">Caption of policy.</message>
+ <message name="IDS_POLICY_ENUMPOLICY_DESC">Description of policy.</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERDISABLED_CAPTION">Option1</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERAUTODETECT_CAPTION">Option2</message>
+ <message name="IDS_POLICY_WIN_SUPPORTED_WINXPSP2">At least Windows 3.14</message>
+ </messages>
+ ''' )
+ output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
+ expected_output = '''CLASS MACHINE
+ CATEGORY !!google
+ CATEGORY !!googlechrome
+ KEYNAME "Software\\Policies\\Google\\Chrome"
+
+ POLICY !!EnumPolicy_Policy
+ #if version >= 4
+ SUPPORTED !!SUPPORTED_WINXPSP2
+ #endif
+ EXPLAIN !!EnumPolicy_Explain
+
+ PART !!EnumPolicy_Part DROPDOWNLIST
+ VALUENAME "EnumPolicy"
+ ITEMLIST
+ NAME !!ProxyServerDisabled_DropDown VALUE "one"
+ NAME !!ProxyServerAutoDetect_DropDown VALUE "two"
+ END ITEMLIST
+ END PART
+ END POLICY
+
+ END CATEGORY
+ END CATEGORY
+
+[Strings]
+SUPPORTED_WINXPSP2="At least Windows 3.14"
+google="Google"
+googlechrome="Google Chrome"
+EnumPolicy_Policy="Caption of policy."
+EnumPolicy_Explain="Description of policy."
+EnumPolicy_Part="Caption of policy."
+ProxyServerDisabled_DropDown="Option1"
+ProxyServerAutoDetect_DropDown="Option2"
+'''
+ self.CompareOutputs(output, expected_output)
+
def testListPolicy(self):
# Tests a policy group with a single policy of type 'list'.
grd = self.PrepareTest('''

Powered by Google App Engine
This is Rietveld 408576698