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

Unified Diff: tools/grit/grit/format/policy_templates/writers/adml_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/adml_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py
index dd4d42e1a3fadec3d18102abf6b9a1916d283cc7..03a43992473a3822fa10f25ee76e2c1ff571c395 100644
--- a/tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py
@@ -158,10 +158,58 @@ class AdmlWriterTest(xml_writer_base_unittest.XmlWriterBaseTest):
'</presentation>')
self.AssertXMLEquals(output, expected_output)
- def testEnumPolicy(self):
+ def testIntEnumPolicy(self):
enum_policy = {
'name': 'EnumPolicyStub',
- 'type': 'enum',
+ 'type': 'int-enum',
+ 'caption': 'Enum policy caption',
+ 'label': 'Enum policy label',
+ 'desc': 'This is a test description.',
+ 'items': [
+ {
+ 'name': 'item 1',
+ 'value': 1,
+ 'caption': 'Caption Item 1',
+ },
+ {
+ 'name': 'item 2',
+ 'value': 2,
+ 'caption': 'Caption Item 2',
+ },
+ ],
+ }
+ self. _InitWriterForAddingPolicies(self.writer, enum_policy)
+ self.writer.WritePolicy(enum_policy)
+ # Assert generated string elements.
+ output = self.GetXMLOfChildren(self.writer._string_table_elem)
+ expected_output = (
+ '<string id="EnumPolicyStub">\n'
+ ' Enum policy caption\n'
+ '</string>\n'
+ '<string id="EnumPolicyStub_Explain">\n'
+ ' This is a test description.\n'
+ '</string>\n'
+ '<string id="item 1">\n'
+ ' Caption Item 1\n'
+ '</string>\n'
+ '<string id="item 2">\n'
+ ' Caption Item 2\n'
+ '</string>')
+ self.AssertXMLEquals(output, expected_output)
+ # Assert generated presentation elements.
+ output = self.GetXMLOfChildren(self.writer._presentation_table_elem)
+ expected_output = (
+ '<presentation id="EnumPolicyStub">\n'
+ ' <dropdownList refId="EnumPolicyStub">\n'
+ ' Enum policy label\n'
+ ' </dropdownList>\n'
+ '</presentation>')
+ self.AssertXMLEquals(output, expected_output)
+
+ def testStringEnumPolicy(self):
+ enum_policy = {
+ 'name': 'EnumPolicyStub',
+ 'type': 'string-enum',
'caption': 'Enum policy caption',
'label': 'Enum policy label',
'desc': 'This is a test description.',

Powered by Google App Engine
This is Rietveld 408576698