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

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

Issue 12521030: Extension docs: Include sidenav in 404 pages (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 7 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/sidenav_data_source_test.py
===================================================================
--- chrome/common/extensions/docs/server2/sidenav_data_source_test.py (revision 202781)
+++ chrome/common/extensions/docs/server2/sidenav_data_source_test.py (working copy)
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import json
import os
import sys
import unittest
@@ -25,16 +26,25 @@
if 'items' in item:
self._CheckLevels(item['items'], level=level + 1)
+ def _ReadLocalFile(self, filename):
+ with open(os.path.join(sys.path[0],
+ 'test_data',
+ 'sidenav_data_source',
+ filename), 'r') as f:
+ return f.read()
+
def testLevels(self):
sidenav_data_source = SidenavDataSource.Factory(self._compiled_fs_factory,
- self._json_path).Create('')
+ self._json_path,
+ '').Create('')
sidenav_json = sidenav_data_source.get('test')
self._CheckLevels(sidenav_json)
def testSelected(self):
sidenav_data_source = SidenavDataSource.Factory(
self._compiled_fs_factory,
- self._json_path).Create('www.b.com')
+ self._json_path,
+ '').Create('www.b.com')
sidenav_json = sidenav_data_source.get('test')
# This will be prettier once JSON is loaded with an OrderedDict.
for item in sidenav_json:
@@ -47,5 +57,15 @@
# If we didn't return already, we should fail.
self.fail()
+ def testAbsolutePath(self):
+ sidenav_data_source = SidenavDataSource.Factory(
+ self._compiled_fs_factory,
+ self._json_path,
+ '/trunk').Create('absolute_path/test.html')
+ sidenav_json = sidenav_data_source.get('absolute_path')
+ self.assertEqual(
+ sidenav_json,
+ json.loads(self._ReadLocalFile('absolute_path_sidenav_expected.json')))
+
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698