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() |