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

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

Issue 695613003: Fix duplicated strings in ADMX templates. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: added tests 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
diff --git a/grit/format/policy_templates/writers/adml_writer_unittest.py b/grit/format/policy_templates/writers/adml_writer_unittest.py
index 8a8f4f7ec863e43e44a08f4726538a48347c70ba..53f1158829d0ac9d21da48d9f43d05da3624594a 100644
--- a/grit/format/policy_templates/writers/adml_writer_unittest.py
+++ b/grit/format/policy_templates/writers/adml_writer_unittest.py
@@ -362,6 +362,62 @@ class AdmlWriterUnittest(xml_writer_base_unittest.XmlWriterBaseTest):
]
}))
+ 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