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

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
« no previous file with comments | « grit/format/policy_templates/writers/doc_writer.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
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 }) 41 })
42 self.writer.messages = { 42 self.writer.messages = {
43 'doc_back_to_top': {'text': '_test_back_to_top'}, 43 'doc_back_to_top': {'text': '_test_back_to_top'},
44 'doc_complex_policies_on_windows': {'text': '_test_complex_policies_win'},
44 'doc_data_type': {'text': '_test_data_type'}, 45 'doc_data_type': {'text': '_test_data_type'},
45 'doc_description': {'text': '_test_description'}, 46 'doc_description': {'text': '_test_description'},
46 'doc_description_column_title': { 47 'doc_description_column_title': {
47 'text': '_test_description_column_title' 48 'text': '_test_description_column_title'
48 }, 49 },
49 'doc_example_value': {'text': '_test_example_value'}, 50 'doc_example_value': {'text': '_test_example_value'},
50 'doc_feature_dynamic_refresh': {'text': '_test_feature_dynamic_refresh'}, 51 'doc_feature_dynamic_refresh': {'text': '_test_feature_dynamic_refresh'},
51 'doc_feature_can_be_recommended': {'text': '_test_feature_recommended'}, 52 'doc_feature_can_be_recommended': {'text': '_test_feature_recommended'},
52 'doc_intro': {'text': '_test_intro'}, 53 'doc_intro': {'text': '_test_intro'},
53 'doc_mac_linux_pref_name': {'text': '_test_mac_linux_pref_name'}, 54 'doc_mac_linux_pref_name': {'text': '_test_mac_linux_pref_name'},
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 '<li>Chrome (iOS) ...34...</li>' 409 '<li>Chrome (iOS) ...34...</li>'
409 '</ul>' 410 '</ul>'
410 '</dd>' 411 '</dd>'
411 '<dt style="style_dt;">_test_supported_features</dt>' 412 '<dt style="style_dt;">_test_supported_features</dt>'
412 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' 413 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
413 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' 414 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>'
414 '<dt style="style_dt;">_test_example_value</dt>' 415 '<dt style="style_dt;">_test_example_value</dt>'
415 '<dd>0x00000000 (Windows), false (Linux), &lt;false /&gt; (Mac)</dd>' 416 '<dd>0x00000000 (Windows), false (Linux), &lt;false /&gt; (Mac)</dd>'
416 '</dl></root>') 417 '</dl></root>')
417 418
419 def testAddDictPolicyDetails(self):
420 # Test if the definition list (<dl>) of policy details is created correctly
421 # for 'dict' policies.
422 policy = {
423 'type': 'dict',
424 'name': 'TestPolicyName',
425 'caption': 'TestPolicyCaption',
426 'desc': 'TestPolicyDesc',
427 'supported_on': [{
428 'product': 'chrome',
429 'platforms': ['win', 'mac', 'linux'],
430 'since_version': '8',
431 'until_version': '',
432 }],
433 'features': {'dynamic_refresh': False},
434 'example_value': { 'foo': 123 }
435 }
436 self.writer.messages['doc_since_version'] = {'text': '...$6...'}
437 self.writer._AddPolicyDetails(self.doc_root, policy)
438 self.assertEquals(
439 self.doc_root.toxml(),
440 '<root><dl>'
441 '<dt style="style_dt;">_test_data_type</dt><dd>Dictionary (REG_SZ; _test_c omplex_policies_win)</dd>'
442 '<dt style="style_dt;">_test_win_reg_loc</dt>'
443 '<dd style="style_.monospace;">MockKey\TestPolicyName</dd>'
444 '<dt style="style_dt;">_test_mac_linux_pref_name</dt>'
445 '<dd style="style_.monospace;">TestPolicyName</dd>'
446 '<dt style="style_dt;">_test_supported_on</dt>'
447 '<dd>'
448 '<ul style="style_ul;">'
449 '<li>Chrome (Windows, Mac, Linux) ...8...</li>'
450 '</ul>'
451 '</dd>'
452 '<dt style="style_dt;">_test_supported_features</dt>'
453 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
454 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>'
455 '<dt style="style_dt;">_test_example_value</dt>'
456 '<dd>'
457 '<dl style="style_dd dl;">'
458 '<dt>Windows:</dt>'
459 '<dd style="style_.monospace;style_.pre;">MockKey\TestPolicyName = { &quot;foo&quot;: 123}</dd>'
460 '<dt>Linux:</dt>'
461 '<dd style="style_.monospace;">TestPolicyName: {&quot;foo&quot;: 123 }</dd>'
462 '<dt>Mac:</dt>'
463 '<dd style="style_.monospace;style_.pre;">'
464 '&lt;key&gt;TestPolicyName&lt;/key&gt;\n'
465 '&lt;dict&gt;\n'
466 ' &lt;key&gt;foo&lt;/key&gt;\n'
467 ' &lt;integer&gt;123&lt;/integer&gt;\n'
468 '&lt;/dict&gt;'
469 '</dd>'
470 '</dl>'
471 '</dd>'
472 '</dl></root>')
473
418 def testAddPolicyNote(self): 474 def testAddPolicyNote(self):
419 # TODO(jkummerow): The functionality tested by this test is currently not 475 # TODO(jkummerow): The functionality tested by this test is currently not
420 # used for anything and will probably soon be removed. 476 # used for anything and will probably soon be removed.
421 # Test if nodes are correctly added to policies. 477 # Test if nodes are correctly added to policies.
422 policy = { 478 policy = {
423 'problem_href': 'http://www.example.com/5' 479 'problem_href': 'http://www.example.com/5'
424 } 480 }
425 self.writer.messages['doc_note'] = {'text': '...$6...'} 481 self.writer.messages['doc_note'] = {'text': '...$6...'}
426 self.writer._AddPolicyNote(self.doc_root, policy) 482 self.writer._AddPolicyNote(self.doc_root, policy)
427 self.assertEquals( 483 self.assertEquals(
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 ' &lt;key&gt;True&lt;/key&gt;\n' 790 ' &lt;key&gt;True&lt;/key&gt;\n'
735 ' &lt;true/&gt;\n' 791 ' &lt;true/&gt;\n'
736 '&lt;/dict&gt;' 792 '&lt;/dict&gt;'
737 '</dd>' 793 '</dd>'
738 '</dl>' 794 '</dl>'
739 '</root>') 795 '</root>')
740 796
741 797
742 if __name__ == '__main__': 798 if __name__ == '__main__':
743 unittest.main() 799 unittest.main()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/doc_writer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698