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

Side by Side Diff: grit/format/policy_templates/writers/doc_writer_unittest.py

Issue 642443004: Add a chromium version to policy template files. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 json
10 import os 10 import os
(...skipping 21 matching lines...) Expand all
32 32
33 def setUp(self): 33 def setUp(self):
34 # Create a writer for the tests. 34 # Create a writer for the tests.
35 self.writer = doc_writer.GetWriter( 35 self.writer = doc_writer.GetWriter(
36 config={ 36 config={
37 'app_name': 'Chrome', 37 'app_name': 'Chrome',
38 'frame_name': 'Chrome Frame', 38 'frame_name': 'Chrome Frame',
39 'os_name': 'Chrome OS', 39 'os_name': 'Chrome OS',
40 'win_reg_mandatory_key_name': 'MockKey', 40 'win_reg_mandatory_key_name': 'MockKey',
41 'win_reg_recommended_key_name': 'MockKeyRec', 41 'win_reg_recommended_key_name': 'MockKeyRec',
42 'build': 'test_product',
42 }) 43 })
43 self.writer.messages = { 44 self.writer.messages = {
44 'doc_back_to_top': {'text': '_test_back_to_top'}, 45 'doc_back_to_top': {'text': '_test_back_to_top'},
45 'doc_complex_policies_on_windows': {'text': '_test_complex_policies_win'}, 46 'doc_complex_policies_on_windows': {'text': '_test_complex_policies_win'},
46 'doc_data_type': {'text': '_test_data_type'}, 47 'doc_data_type': {'text': '_test_data_type'},
47 'doc_description': {'text': '_test_description'}, 48 'doc_description': {'text': '_test_description'},
48 'doc_description_column_title': { 49 'doc_description_column_title': {
49 'text': '_test_description_column_title' 50 'text': '_test_description_column_title'
50 }, 51 },
51 'doc_example_value': {'text': '_test_example_value'}, 52 'doc_example_value': {'text': '_test_example_value'},
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 '<td style="style_td;style_td.right;style_thead td;">' 97 '<td style="style_td;style_td.right;style_thead td;">'
97 '_test_description_column_title' 98 '_test_description_column_title'
98 '</td>' 99 '</td>'
99 '</tr></thead>' 100 '</tr></thead>'
100 '<tbody/>' 101 '<tbody/>'
101 '</table>' 102 '</table>'
102 '</div>' 103 '</div>'
103 '<div/>' 104 '<div/>'
104 '</div>') 105 '</div>')
105 106
107 def testVersionAnnotation(self):
108 # Test if DocWriter creates the skeleton of the document correctly.
109 self.writer.config['version'] = '39.0.0.0'
110 self.writer.BeginTemplate()
111 self.assertEquals(
112 self.writer._main_div.toxml(),
113 '<div>'
114 '<!--test_product version: 39.0.0.0-->'
115 '<div>'
116 '<a name="top"/><br/>_test_intro<br/><br/><br/>'
117 '<table style="style_table;">'
118 '<thead><tr style="style_tr;">'
119 '<td style="style_td;style_td.left;style_thead td;">'
120 '_test_name_column_title'
121 '</td>'
122 '<td style="style_td;style_td.right;style_thead td;">'
123 '_test_description_column_title'
124 '</td>'
125 '</tr></thead>'
126 '<tbody/>'
127 '</table>'
128 '</div>'
129 '<div/>'
130 '</div>')
131
106 def testGetLocalizedMessage(self): 132 def testGetLocalizedMessage(self):
107 # Test if localized messages are retrieved correctly. 133 # Test if localized messages are retrieved correctly.
108 self.writer.messages = { 134 self.writer.messages = {
109 'doc_hello_world': {'text': 'hello, vilag!'} 135 'doc_hello_world': {'text': 'hello, vilag!'}
110 } 136 }
111 self.assertEquals( 137 self.assertEquals(
112 self.writer._GetLocalizedMessage('hello_world'), 138 self.writer._GetLocalizedMessage('hello_world'),
113 'hello, vilag!') 139 'hello, vilag!')
114 140
115 def testMapListToString(self): 141 def testMapListToString(self):
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 ' &lt;key&gt;True&lt;/key&gt;\n' 874 ' &lt;key&gt;True&lt;/key&gt;\n'
849 ' &lt;true/&gt;\n' 875 ' &lt;true/&gt;\n'
850 '&lt;/dict&gt;' 876 '&lt;/dict&gt;'
851 '</dd>' 877 '</dd>'
852 '</dl>' 878 '</dl>'
853 '</root>') 879 '</root>')
854 880
855 881
856 if __name__ == '__main__': 882 if __name__ == '__main__':
857 unittest.main() 883 unittest.main()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/doc_writer.py ('k') | grit/format/policy_templates/writers/ios_plist_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698