| Index: tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py
|
| diff --git a/tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py
|
| index 7d9e1fb007895b6f8310ab963777ca958def61e9..6a5fd42026699edab5c24d1ed0ac84b1523bc0b1 100644
|
| --- a/tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py
|
| +++ b/tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py
|
| @@ -153,11 +153,11 @@ class DocWriterUnittest(writer_unittest_common.WriterUnittestCommon):
|
| e3.toxml(),
|
| '<z a="b" style="style1;style2;">text</z>')
|
|
|
| - def testAddDescription(self):
|
| - # Test if URLs are replaced and choices of 'enum' policies are listed
|
| + def testAddDescriptionIntEnum(self):
|
| + # Test if URLs are replaced and choices of 'int-enum' policies are listed
|
| # correctly.
|
| policy = {
|
| - 'type': 'enum',
|
| + 'type': 'int-enum',
|
| 'items': [
|
| {'value': 0, 'caption': 'Disable foo'},
|
| {'value': 2, 'caption': 'Solve your problem'},
|
| @@ -174,6 +174,27 @@ See http://policy-explanation.example.com for more details.
|
| See <a href="http://policy-explanation.example.com">http://policy-explanation.example.com</a> for more details.
|
| <ul><li>0 = Disable foo</li><li>2 = Solve your problem</li><li>5 = Enable bar</li></ul></root>''')
|
|
|
| + def testAddDescriptionStringEnum(self):
|
| + # Test if URLs are replaced and choices of 'int-enum' policies are listed
|
| + # correctly.
|
| + policy = {
|
| + 'type': 'string-enum',
|
| + 'items': [
|
| + {'value': "one", 'caption': 'Disable foo'},
|
| + {'value': "two", 'caption': 'Solve your problem'},
|
| + {'value': "three", 'caption': 'Enable bar'},
|
| + ],
|
| + 'desc': '''This policy disables foo, except in case of bar.
|
| +See http://policy-explanation.example.com for more details.
|
| +'''
|
| + }
|
| + self.writer._AddDescription(self.doc_root, policy)
|
| + self.assertEquals(
|
| + self.doc_root.toxml(),
|
| + '''<root>This policy disables foo, except in case of bar.
|
| +See <a href="http://policy-explanation.example.com">http://policy-explanation.example.com</a> for more details.
|
| +<ul><li>"one" = Disable foo</li><li>"two" = Solve your problem</li><li>"three" = Enable bar</li></ul></root>''')
|
| +
|
| def testAddFeatures(self):
|
| # Test if the list of features of a policy is handled correctly.
|
| policy = {
|
| @@ -252,11 +273,11 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
|
| e2.toxml(),
|
| '<e2>0x00000000 (Windows), false (Linux), <false /> (Mac)</e2>')
|
|
|
| - def testEnumExample(self):
|
| - # Test representation of 'enum' example values.
|
| + def testIntEnumExample(self):
|
| + # Test representation of 'int-enum' example values.
|
| policy = {
|
| 'name': 'PolicyName',
|
| - 'type': 'enum',
|
| + 'type': 'int-enum',
|
| 'annotations': {
|
| 'example_value': 16
|
| }
|
| @@ -266,6 +287,20 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
|
| self.doc_root.toxml(),
|
| '<root>0x00000010 (Windows), 16 (Linux/Mac)</root>')
|
|
|
| + def testStringEnumExample(self):
|
| + # Test representation of 'int-enum' example values.
|
| + policy = {
|
| + 'name': 'PolicyName',
|
| + 'type': 'string-enum',
|
| + 'annotations': {
|
| + 'example_value': "wacky"
|
| + }
|
| + }
|
| + self.writer._AddExample(self.doc_root, policy)
|
| + self.assertEquals(
|
| + self.doc_root.toxml(),
|
| + '<root>"wacky"</root>')
|
| +
|
| def testStringExample(self):
|
| # Test representation of 'string' example values.
|
| policy = {
|
|
|