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

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

Issue 6176005: Support int-typed policies in policy template generator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment 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 03a43992473a3822fa10f25ee76e2c1ff571c395..0ac74a620529438239c1a93726b3069b2b5e05ee 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
@@ -1,5 +1,5 @@
#!/usr/bin/python2.4
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -55,7 +55,7 @@ class AdmlWriterTest(xml_writer_base_unittest.XmlWriterBaseTest):
}
writer.BeginPolicyGroup(policy_group)
- string_elements =\
+ string_elements = \
self.writer._string_table_elem.getElementsByTagName('string')
for elem in string_elements:
self.writer._string_table_elem.removeChild(elem)
@@ -158,6 +158,38 @@ class AdmlWriterTest(xml_writer_base_unittest.XmlWriterBaseTest):
'</presentation>')
self.AssertXMLEquals(output, expected_output)
+ def testIntPolicy(self):
+ int_policy = {
+ 'name': 'IntPolicyStub',
+ 'type': 'int',
+ 'caption': 'Int policy caption',
+ 'label': 'Int policy label',
+ 'desc': 'This is a test description.',
+ }
+ self. _InitWriterForAddingPolicies(self.writer, int_policy)
+ self.writer.WritePolicy(int_policy)
+ # Assert generated string elements.
+ output = self.GetXMLOfChildren(self.writer._string_table_elem)
+ expected_output = (
+ '<string id="IntPolicyStub">\n'
+ ' Int policy caption\n'
+ '</string>\n'
+ '<string id="IntPolicyStub_Explain">\n'
+ ' This is a test description.\n'
+ '</string>')
+ self.AssertXMLEquals(output, expected_output)
+ # Assert generated presentation elements.
+ output = self.GetXMLOfChildren(self.writer._presentation_table_elem)
+ expected_output = (
+ '<presentation id="IntPolicyStub">\n'
+ ' <decimalTextBox refId="IntPolicyStub">\n'
+ ' <label>\n'
+ ' Int policy label\n'
+ ' </label>\n'
+ ' </decimalTextBox>\n'
+ '</presentation>')
+ self.AssertXMLEquals(output, expected_output)
+
def testIntEnumPolicy(self):
enum_policy = {
'name': 'EnumPolicyStub',

Powered by Google App Engine
This is Rietveld 408576698