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

Unified Diff: tools/grit/grit/format/policy_templates/policy_template_generator_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/policy_template_generator_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py b/tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py
index d51c0a50c0c9c32c66f5fefd607716d9ad2cad8e..fe2721645d035d9121cdc8d949d6a3782f40533e 100644
--- a/tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py
+++ b/tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py
@@ -211,7 +211,7 @@ class PolicyTemplateGeneratorUnittest(unittest.TestCase):
self.tester.fail()
self.do_test(messages_mock, policy_defs_mock, LocalMockWriter())
- def testEnumTexts(self):
+ def testIntEnumTexts(self):
# Test that GUI messages are assigned correctly to enums
# (aka dropdown menus).
messages_mock = {
@@ -224,12 +224,41 @@ class PolicyTemplateGeneratorUnittest(unittest.TestCase):
}
policy_defs_mock = [{
'name': 'Policy1',
- 'type': 'enum',
+ 'type': 'int-enum',
'supported_on': [],
'items': [
- {'name': 'item1', 'value': '0'},
- {'name': 'item2', 'value': '1'},
- {'name': 'item3', 'value': '3'},
+ {'name': 'item1', 'value': 0},
+ {'name': 'item2', 'value': 1},
+ {'name': 'item3', 'value': 3},
+ ]
+ }]
+
+ class LocalMockWriter(mock_writer.MockWriter):
+ def WritePolicy(self, policy):
+ self.tester.assertEquals(policy['items'][0]['caption'], 'string1')
+ self.tester.assertEquals(policy['items'][1]['caption'], 'string2')
+ self.tester.assertEquals(policy['items'][2]['caption'], 'string3')
+ self.do_test(messages_mock, policy_defs_mock, LocalMockWriter())
+
+ def testStringEnumTexts(self):
+ # Test that GUI messages are assigned correctly to enums
+ # (aka dropdown menus).
+ messages_mock = {
+ 'IDS_POLICY_ENUM_ITEM1_CAPTION': 'string1',
+ 'IDS_POLICY_ENUM_ITEM2_CAPTION': 'string2',
+ 'IDS_POLICY_ENUM_ITEM3_CAPTION': 'string3',
+ 'IDS_POLICY_POLICY1_CAPTION': '',
+ 'IDS_POLICY_POLICY1_DESC': '',
+
+ }
+ policy_defs_mock = [{
+ 'name': 'Policy1',
+ 'type': 'string-enum',
+ 'supported_on': [],
+ 'items': [
+ {'name': 'item1', 'value': 'one'},
+ {'name': 'item2', 'value': 'two'},
+ {'name': 'item3', 'value': 'three'},
]
}]

Powered by Google App Engine
This is Rietveld 408576698