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

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

Issue 702793003: Fix duplicated strings in ADMX templates. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 1 month 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/adml_writer_unittest.py
===================================================================
--- grit/format/policy_templates/writers/adml_writer_unittest.py (revision 180)
+++ grit/format/policy_templates/writers/adml_writer_unittest.py (working copy)
@@ -376,6 +376,62 @@
]
}))
+ def testStringEncodings(self):
+ enum_policy_a = {
+ 'name': 'EnumPolicy.A',
+ 'type': 'string-enum',
+ 'caption': 'Enum policy A caption',
+ 'label': 'Enum policy A label',
+ 'desc': 'This is a test description.',
+ 'items': [
+ {
+ 'name': 'tls1.2',
+ 'value': 'tls1.2',
+ 'caption': 'tls1.2',
+ }
+ ],
+ }
+ enum_policy_b = {
+ 'name': 'EnumPolicy.B',
+ 'type': 'string-enum',
+ 'caption': 'Enum policy B caption',
+ 'label': 'Enum policy B label',
+ 'desc': 'This is a test description.',
+ 'items': [
+ {
+ 'name': 'tls1.2',
+ 'value': 'tls1.2',
+ 'caption': 'tls1.2',
+ }
+ ],
+ }
+ self. _InitWriterForAddingPolicies(self.writer, enum_policy_a)
+ self.writer.WritePolicy(enum_policy_a)
+ self.writer.WritePolicy(enum_policy_b)
+ # Assert generated string elements.
+ output = self.GetXMLOfChildren(self.writer._string_table_elem)
+ expected_output = (
+ '<string id="EnumPolicy_A">Enum policy A caption</string>\n'
+ '<string id="EnumPolicy_A_Explain">'
+ 'This is a test description.</string>\n'
+ '<string id="tls1_2">tls1.2</string>\n'
+ '<string id="EnumPolicy_B">Enum policy B caption</string>\n'
+ '<string id="EnumPolicy_B_Explain">'
+ 'This is a test description.</string>\n')
+ self.AssertXMLEquals(output, expected_output)
+ # Assert generated presentation elements.
+ output = self.GetXMLOfChildren(self.writer._presentation_table_elem)
+ expected_output = (
+ '<presentation id="EnumPolicy.A">\n'
+ ' <dropdownList refId="EnumPolicy.A">'
+ 'Enum policy A label</dropdownList>\n'
+ '</presentation>\n'
+ '<presentation id="EnumPolicy.B">\n'
+ ' <dropdownList refId="EnumPolicy.B">'
+ 'Enum policy B label</dropdownList>\n'
+ '</presentation>')
+ self.AssertXMLEquals(output, expected_output)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « grit/format/policy_templates/writers/adml_writer.py ('k') | grit/format/policy_templates/writers/admx_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698