diff options
author | gfeher@chromium.org <gfeher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-29 18:30:46 +0000 |
---|---|---|
committer | gfeher@chromium.org <gfeher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-29 18:30:46 +0000 |
commit | 10049e36c55d2d58395d31c226fc5e212a161441 (patch) | |
tree | 2c9abdd5e90718a210a02d8a4f0f7ae49ef9fb98 /tools/grit | |
parent | 9641e22aa3ab02a7ed362f9301c20fe8924aa842 (diff) | |
download | chromium_src-10049e36c55d2d58395d31c226fc5e212a161441.zip chromium_src-10049e36c55d2d58395d31c226fc5e212a161441.tar.gz chromium_src-10049e36c55d2d58395d31c226fc5e212a161441.tar.bz2 |
Fix example lists and untranslated text in generated policy documentation
Lists stored in Windows Registry should start numbering from 1 and not from
0. Strings displayed in the generated documentation should not be
hard-coded, but come from the .grd file.
BUG=64405,64213
TEST=python:DocWriterUnittest.*
Review URL: http://codereview.chromium.org/5358004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/grit')
-rw-r--r-- | tools/grit/grit/format/policy_templates/writers/doc_writer.py | 4 | ||||
-rw-r--r-- | tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py | 35 |
2 files changed, 27 insertions, 12 deletions
diff --git a/tools/grit/grit/format/policy_templates/writers/doc_writer.py b/tools/grit/grit/format/policy_templates/writers/doc_writer.py index 1f4afe7..320e79d 100644 --- a/tools/grit/grit/format/policy_templates/writers/doc_writer.py +++ b/tools/grit/grit/format/policy_templates/writers/doc_writer.py @@ -171,7 +171,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): self.AddElement(parent, 'dt', {}, 'Windows:') win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre']) win_text = [] - cnt = 0 + cnt = 1 for item in example_value: win_text.append( '%s\\%s\\%d = "%s"' % @@ -484,7 +484,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): } # Human-readable names of supported features. self._FEATURE_MAP = { - 'dynamic_refresh': 'Dynamic Policy Refresh' + 'dynamic_refresh': self._GetLocalizedMessage('feature_dynamic_refresh') } # Human-readable names of types. self._TYPE_MAP = { 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 8f1ec8c..7d9e1fb0 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 @@ -159,9 +159,9 @@ class DocWriterUnittest(writer_unittest_common.WriterUnittestCommon): policy = { 'type': 'enum', 'items': [ - {'value': '0', 'caption': 'Disable foo'}, - {'value': '2', 'caption': 'Solve your problem'}, - {'value': '5', 'caption': 'Enable bar'}, + {'value': 0, 'caption': 'Disable foo'}, + {'value': 2, 'caption': 'Solve your problem'}, + {'value': 5, 'caption': 'Enable bar'}, ], 'desc': '''This policy disables foo, except in case of bar. See http://policy-explanation.example.com for more details. @@ -203,11 +203,26 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex self.writer._AddListExample(self.doc_root, policy) self.assertEquals( self.doc_root.toxml(), - '''<root><dl style="style_dd dl;"><dt>Windows:</dt><dd style="style_.monospace;style_.pre;">MockKey\\PolicyName\\0 = "Foo" -MockKey\\PolicyName\\1 = "Bar"</dd><dt>Linux:</dt><dd style="style_.monospace;">["Foo", "Bar"]</dd><dt>Mac:</dt><dd style="style_.monospace;style_.pre;"><array> - <string>Foo</string> - <string>Bar</string> -</array></dd></dl></root>''') + '<root>' + '<dl style="style_dd dl;">' + '<dt>Windows:</dt>' + '<dd style="style_.monospace;style_.pre;">' + 'MockKey\\PolicyName\\1 = "Foo"\n' + 'MockKey\\PolicyName\\2 = "Bar"' + '</dd>' + '<dt>Linux:</dt>' + '<dd style="style_.monospace;">' + '["Foo", "Bar"]' + '</dd>' + '<dt>Mac:</dt>' + '<dd style="style_.monospace;style_.pre;">' + '<array>\n' + ' <string>Foo</string>\n' + ' <string>Bar</string>\n' + '</array>' + '</dd>' + '</dl>' + '</root>') def testBoolExample(self): # Test representation of boolean example values. @@ -311,7 +326,7 @@ MockKey\\PolicyName\\1 = "Bar"</dd><dt>Linux:</dt><dd style="style_.mo '</ul>' '</dd>' '<dt style="style_dt;">_test_supported_features</dt>' - '<dd>Dynamic Policy Refresh: _test_not_supported</dd>' + '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' '<dt style="style_dt;">_test_example_value</dt>' '<dd>0x00000000 (Windows), false (Linux), <false /> (Mac)</dd>' @@ -405,7 +420,7 @@ MockKey\\PolicyName\\1 = "Bar"</dd><dt>Linux:</dt><dd style="style_.mo '</ul>' '</dd>' '<dt style="style_dt;">_test_supported_features</dt>' - '<dd>Dynamic Policy Refresh: _test_not_supported</dd>' + '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' '<dt style="style_dt;">_test_description</dt>' '<dd>PolicyDesc</dd>' '<dt style="style_dt;">_test_example_value</dt>' |