| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 '''Unit tests for grit.format.policy_templates.writers.doc_writer''' | 6 '''Unit tests for grit.format.policy_templates.writers.doc_writer''' |
| 7 | 7 |
| 8 | 8 |
| 9 import json |
| 9 import os | 10 import os |
| 10 import sys | 11 import sys |
| 11 if __name__ == '__main__': | 12 if __name__ == '__main__': |
| 12 sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..')) | 13 sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..')) |
| 13 | 14 |
| 14 import unittest | 15 import unittest |
| 15 from xml.dom import minidom | 16 from xml.dom import minidom |
| 16 | 17 |
| 17 from grit.format.policy_templates.writers import writer_unittest_common | 18 from grit.format.policy_templates.writers import writer_unittest_common |
| 18 from grit.format.policy_templates.writers import doc_writer | 19 from grit.format.policy_templates.writers import doc_writer |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 "A": 1, | 682 "A": 1, |
| 682 "B": 2, | 683 "B": 2, |
| 683 }, { | 684 }, { |
| 684 "C": 3, | 685 "C": 3, |
| 685 "D": 4, | 686 "D": 4, |
| 686 }, | 687 }, |
| 687 ], | 688 ], |
| 688 }, | 689 }, |
| 689 } | 690 } |
| 690 self.writer._AddDictionaryExample(self.doc_root, policy) | 691 self.writer._AddDictionaryExample(self.doc_root, policy) |
| 691 value = str(policy['example_value']) | 692 value = json.dumps(policy['example_value']).replace('"', '"') |
| 692 self.assertEquals( | 693 self.assertEquals( |
| 693 self.doc_root.toxml(), | 694 self.doc_root.toxml(), |
| 694 '<root>' | 695 '<root>' |
| 695 '<dl style="style_dd dl;">' | 696 '<dl style="style_dd dl;">' |
| 696 '<dt>Windows:</dt>' | 697 '<dt>Windows:</dt>' |
| 697 '<dd style="style_.monospace;style_.pre;">MockKey\PolicyName = ' | 698 '<dd style="style_.monospace;style_.pre;">MockKey\PolicyName = ' |
| 698 '"' + value + '"' | 699 + value + |
| 699 '</dd>' | 700 '</dd>' |
| 700 '<dt>Linux:</dt>' | 701 '<dt>Linux:</dt>' |
| 701 '<dd style="style_.monospace;">PolicyName: ' + value + '</dd>' | 702 '<dd style="style_.monospace;">PolicyName: ' + value + '</dd>' |
| 702 '<dt>Mac:</dt>' | 703 '<dt>Mac:</dt>' |
| 703 '<dd style="style_.monospace;style_.pre;">' | 704 '<dd style="style_.monospace;style_.pre;">' |
| 704 '<key>PolicyName</key>\n' | 705 '<key>PolicyName</key>\n' |
| 705 '<dict>\n' | 706 '<dict>\n' |
| 706 ' <key>DictList</key>\n' | 707 ' <key>DictList</key>\n' |
| 707 ' <array>\n' | 708 ' <array>\n' |
| 708 ' <dict>\n' | 709 ' <dict>\n' |
| (...skipping 24 matching lines...) Expand all Loading... |
| 733 ' <key>True</key>\n' | 734 ' <key>True</key>\n' |
| 734 ' <true/>\n' | 735 ' <true/>\n' |
| 735 '</dict>' | 736 '</dict>' |
| 736 '</dd>' | 737 '</dd>' |
| 737 '</dl>' | 738 '</dl>' |
| 738 '</root>') | 739 '</root>') |
| 739 | 740 |
| 740 | 741 |
| 741 if __name__ == '__main__': | 742 if __name__ == '__main__': |
| 742 unittest.main() | 743 unittest.main() |
| OLD | NEW |