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

Unified Diff: chrome/common/extensions/docs/server2/intro_data_source_test.py

Issue 13470005: Refactor the devserver to make it easier to control caching (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cduvall, rebase Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/intro_data_source_test.py
diff --git a/chrome/common/extensions/docs/server2/intro_data_source_test.py b/chrome/common/extensions/docs/server2/intro_data_source_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..90f2c76de4c146147104d2176c17b6d2c475e42b
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/intro_data_source_test.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from server_instance import ServerInstance
+import svn_constants
+from test_file_system import TestFileSystem
+import unittest
+
+_TEST_DATA = TestFileSystem.MoveTo(svn_constants.INTRO_PATH, {
+ 'test.html': '<h1>hello</h1>world<h2>first</h2><h3>inner</h3><h2>second</h2>'
+})
+
+class IntroDataSourceTest(unittest.TestCase):
+ def setUp(self):
+ self._server = ServerInstance.CreateForTest(TestFileSystem(_TEST_DATA))
+
+ def testIntro(self):
+ intro_data_source = self._server.intro_data_source_factory.Create()
+ data = intro_data_source.get('test')
+ self.assertEqual('hello', data['title'])
+ # TODO(kalman): test links.
+ expected_toc = [{'subheadings': [{'link': '', 'title': u'inner'}],
+ 'link': '',
+ 'title': u'first'},
+ {'subheadings': [], 'link': '', 'title': u'second'}]
+ self.assertEqual(expected_toc, data['apps_toc'])
+ self.assertEqual(expected_toc, data['extensions_toc'])
+ self.assertEqual('world<h2>first</h2><h3>inner</h3><h2>second</h2>',
+ data['intro'].render().text)
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698