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

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

Issue 515923002: Link to the documentation for complex policies on Windows. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 3 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 os 9 import os
10 import sys 10 import sys
(...skipping 22 matching lines...) Expand all
33 # Create a writer for the tests. 33 # Create a writer for the tests.
34 self.writer = doc_writer.GetWriter( 34 self.writer = doc_writer.GetWriter(
35 config={ 35 config={
36 'app_name': 'Chrome', 36 'app_name': 'Chrome',
37 'frame_name': 'Chrome Frame', 37 'frame_name': 'Chrome Frame',
38 'os_name': 'Chrome OS', 38 'os_name': 'Chrome OS',
39 'win_reg_mandatory_key_name': 'MockKey', 39 'win_reg_mandatory_key_name': 'MockKey',
40 }) 40 })
41 self.writer.messages = { 41 self.writer.messages = {
42 'doc_back_to_top': {'text': '_test_back_to_top'}, 42 'doc_back_to_top': {'text': '_test_back_to_top'},
43 'doc_complex_policies_on_windows': {'text': '_test_complex_policies_win'},
43 'doc_data_type': {'text': '_test_data_type'}, 44 'doc_data_type': {'text': '_test_data_type'},
44 'doc_description': {'text': '_test_description'}, 45 'doc_description': {'text': '_test_description'},
45 'doc_description_column_title': { 46 'doc_description_column_title': {
46 'text': '_test_description_column_title' 47 'text': '_test_description_column_title'
47 }, 48 },
48 'doc_example_value': {'text': '_test_example_value'}, 49 'doc_example_value': {'text': '_test_example_value'},
49 'doc_feature_dynamic_refresh': {'text': '_test_feature_dynamic_refresh'}, 50 'doc_feature_dynamic_refresh': {'text': '_test_feature_dynamic_refresh'},
50 'doc_feature_can_be_recommended': {'text': '_test_feature_recommended'}, 51 'doc_feature_can_be_recommended': {'text': '_test_feature_recommended'},
51 'doc_intro': {'text': '_test_intro'}, 52 'doc_intro': {'text': '_test_intro'},
52 'doc_mac_linux_pref_name': {'text': '_test_mac_linux_pref_name'}, 53 'doc_mac_linux_pref_name': {'text': '_test_mac_linux_pref_name'},
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 '<li>Chrome (iOS) ...34...</li>' 408 '<li>Chrome (iOS) ...34...</li>'
408 '</ul>' 409 '</ul>'
409 '</dd>' 410 '</dd>'
410 '<dt style="style_dt;">_test_supported_features</dt>' 411 '<dt style="style_dt;">_test_supported_features</dt>'
411 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' 412 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
412 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' 413 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>'
413 '<dt style="style_dt;">_test_example_value</dt>' 414 '<dt style="style_dt;">_test_example_value</dt>'
414 '<dd>0x00000000 (Windows), false (Linux), &lt;false /&gt; (Mac)</dd>' 415 '<dd>0x00000000 (Windows), false (Linux), &lt;false /&gt; (Mac)</dd>'
415 '</dl></root>') 416 '</dl></root>')
416 417
418 def testAddDictPolicyDetails(self):
419 # Test if the definition list (<dl>) of policy details is created correctly
420 # for 'dict' policies.
421 policy = {
422 'type': 'dict',
423 'name': 'TestPolicyName',
424 'caption': 'TestPolicyCaption',
425 'desc': 'TestPolicyDesc',
426 'supported_on': [{
427 'product': 'chrome',
428 'platforms': ['win', 'mac', 'linux'],
429 'since_version': '8',
430 'until_version': '',
431 }],
432 'features': {'dynamic_refresh': False},
433 'example_value': { 'foo': 123 }
434 }
435 self.writer.messages['doc_since_version'] = {'text': '...$6...'}
436 self.writer._AddPolicyDetails(self.doc_root, policy)
437 self.assertEquals(
438 self.doc_root.toxml(),
439 '<root><dl>'
440 '<dt style="style_dt;">_test_data_type</dt><dd>Dictionary (REG_SZ; _test_c omplex_policies_win)</dd>'
441 '<dt style="style_dt;">_test_win_reg_loc</dt>'
442 '<dd style="style_.monospace;">MockKey\TestPolicyName</dd>'
443 '<dt style="style_dt;">_test_mac_linux_pref_name</dt>'
444 '<dd style="style_.monospace;">TestPolicyName</dd>'
445 '<dt style="style_dt;">_test_supported_on</dt>'
446 '<dd>'
447 '<ul style="style_ul;">'
448 '<li>Chrome (Windows, Mac, Linux) ...8...</li>'
449 '</ul>'
450 '</dd>'
451 '<dt style="style_dt;">_test_supported_features</dt>'
452 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
453 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>'
454 '<dt style="style_dt;">_test_example_value</dt>'
455 '<dd>'
456 '<dl style="style_dd dl;">'
457 '<dt>Windows:</dt>'
458 '<dd style="style_.monospace;style_.pre;">MockKey\TestPolicyName = { &quot;foo&quot;: 123}</dd>'
459 '<dt>Linux:</dt>'
460 '<dd style="style_.monospace;">TestPolicyName: {&quot;foo&quot;: 123 }</dd>'
461 '<dt>Mac:</dt>'
462 '<dd style="style_.monospace;style_.pre;">'
463 '&lt;key&gt;TestPolicyName&lt;/key&gt;\n'
464 '&lt;dict&gt;\n'
465 ' &lt;key&gt;foo&lt;/key&gt;\n'
466 ' &lt;integer&gt;123&lt;/integer&gt;\n'
467 '&lt;/dict&gt;'
468 '</dd>'
469 '</dl>'
470 '</dd>'
471 '</dl></root>')
472
417 def testAddPolicyNote(self): 473 def testAddPolicyNote(self):
418 # TODO(jkummerow): The functionality tested by this test is currently not 474 # TODO(jkummerow): The functionality tested by this test is currently not
419 # used for anything and will probably soon be removed. 475 # used for anything and will probably soon be removed.
420 # Test if nodes are correctly added to policies. 476 # Test if nodes are correctly added to policies.
421 policy = { 477 policy = {
422 'problem_href': 'http://www.example.com/5' 478 'problem_href': 'http://www.example.com/5'
423 } 479 }
424 self.writer.messages['doc_note'] = {'text': '...$6...'} 480 self.writer.messages['doc_note'] = {'text': '...$6...'}
425 self.writer._AddPolicyNote(self.doc_root, policy) 481 self.writer._AddPolicyNote(self.doc_root, policy)
426 self.assertEquals( 482 self.assertEquals(
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 ' &lt;key&gt;True&lt;/key&gt;\n' 789 ' &lt;key&gt;True&lt;/key&gt;\n'
734 ' &lt;true/&gt;\n' 790 ' &lt;true/&gt;\n'
735 '&lt;/dict&gt;' 791 '&lt;/dict&gt;'
736 '</dd>' 792 '</dd>'
737 '</dl>' 793 '</dl>'
738 '</root>') 794 '</root>')
739 795
740 796
741 if __name__ == '__main__': 797 if __name__ == '__main__':
742 unittest.main() 798 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698