Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/content_provider_test.py |
| diff --git a/chrome/common/extensions/docs/server2/content_provider_test.py b/chrome/common/extensions/docs/server2/content_provider_test.py |
| index d672acae2b67ae22f60f82efe0f52e792b4ab728..2fa3a0e515441009deda491c480f75bd73cb67a3 100755 |
| --- a/chrome/common/extensions/docs/server2/content_provider_test.py |
| +++ b/chrome/common/extensions/docs/server2/content_provider_test.py |
| @@ -15,12 +15,35 @@ from object_store_creator import ObjectStoreCreator |
| from test_file_system import TestFileSystem |
| from third_party.handlebar import Handlebar |
| - |
| _REDIRECTS_JSON = json.dumps({ |
| 'oldfile.html': 'storage.html', |
| 'index.html': 'https://developers.google.com/chrome', |
| }) |
| +def _ToMarkDownOriginalText(obj): |
|
not at google - send to devlin
2014/01/03 03:18:01
let's decide whether it's mark_down/MarkDown or ma
hukun
2014/01/06 08:25:19
Done
|
| + markdown_text = '' |
| + for text, html in obj.iteritems(): |
| + if markdown_text != '': |
| + markdown_text += '\n' |
| + markdown_text += text |
| + return markdown_text |
| + |
| +def _ToCompiledMarkDownHTML(obj): |
| + markdown_html = '' |
| + for text, html in obj.iteritems(): |
| + if markdown_html != '': |
| + markdown_html += '\n' |
| + markdown_html += html |
| + return markdown_html |
| + |
| + |
| +_MARK_DOWN_CONTENT = { |
| + '# Header 1 #': u'<h1 id="header-1">Header 1</h1>', |
|
not at google - send to devlin
2014/01/03 03:18:01
having this as a dict is a bit odd since it means
hukun
2014/01/06 08:25:19
Done
|
| + '1. Foo\n': u'<ol>\n<li>Foo</li>\n</ol>', |
| + '\n': |
| + u'<p><img alt="alt text" src="/path/img.jpg" title="Title" /></p>', |
| + '* Unordered item 1': '<ul>\n<li>Unordered item 1</li>\n</ul>', |
| +} |
| # Test file system data which exercises many different mimetypes. |
| _TEST_DATA = { |
| @@ -46,6 +69,7 @@ _TEST_DATA = { |
| 'run.js': 'run.js content', |
| 'site.css': 'site.css content', |
| 'storage.html': 'storage.html content', |
| + 'markdown.md': _ToMarkDownOriginalText(_MARK_DOWN_CONTENT) |
|
not at google - send to devlin
2014/01/03 03:18:01
you could write this pretty simply as:
'markdown.
hukun
2014/01/06 08:25:19
Done
|
| } |
| @@ -120,6 +144,13 @@ class ContentProviderUnittest(unittest.TestCase): |
| ['dir3/a.txt', 'dir3/b.txt', 'dir3/c/d.txt'], 'application/zip', |
| content_and_type) |
| + def testMarkdown(self): |
| + content_and_type = self._content_provider.GetContentAndType( |
| + 'markdown.html').Get() |
| + content_and_type.content = content_and_type.content.source |
| + self._assertContent(_ToCompiledMarkDownHTML(_MARK_DOWN_CONTENT), |
|
not at google - send to devlin
2014/01/03 03:18:01
_ToCompiledMarkDown on next line (like all of the
hukun
2014/01/06 08:25:19
Done
|
| + 'text/html', content_and_type) |
| + |
| def testNotFound(self): |
| self.assertRaises( |
| FileNotFoundError, |