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

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

Issue 148293018: Docserver: Make the .html extension unnecessary for content pages, for example, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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/integration_test.py
diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py
index 7311d8a09c07ce72acfa3888f7a70920892ffb7a..a8546f97bf2e1c69377958b1621dc658a86da9eb 100755
--- a/chrome/common/extensions/docs/server2/integration_test.py
+++ b/chrome/common/extensions/docs/server2/integration_test.py
@@ -66,7 +66,7 @@ def _GetPublicFiles():
public_files[request_path] = f.read()
return public_files
- # Public file locations are defined in content_providers.json, sort of. Epic
+ # Public file locations are defined in content_providers.json, sort of. Epic
# hack to pull them out; list all the files from the directories that
# Chromium content providers ask for.
public_files = {}
@@ -154,11 +154,16 @@ class IntegrationTest(unittest.TestCase):
print('Rendering %s public files...' % len(public_files.keys()))
start_time = time.time()
try:
- for path, content in public_files.iteritems():
- AssertIsValid(path)
- if path.endswith('redirects.json'):
+ for fs_path, content in public_files.iteritems():
+ AssertIsValid(fs_path)
+ if fs_path.endswith('redirects.json'):
continue
+ path, ext = posixpath.splitext(fs_path)
+ # Manually exclude examples because we still serve those with .html.
+ if '/examples/' in path or ext not in ('.html', '.md'):
+ path = fs_path
+
def check_result(response):
self.assertEqual(200, response.status,
'Got %s when rendering %s' % (response.status, path))
@@ -171,27 +176,28 @@ class IntegrationTest(unittest.TestCase):
check_result(Handler(Request.ForTest(path)).Get())
if path.startswith(('apps/', 'extensions/')):
- # Make sure that leaving out the .html will temporarily redirect to
- # the path with the .html for APIs and articles.
+ # Make sure that adding the .html will temporarily redirect to
+ # the path without the .html for APIs and articles.
if '/examples/' not in path:
- base, _ = posixpath.splitext(path)
+ redirect_response = Handler(Request.ForTest(path + '.html')).Get()
self.assertEqual(
- ('/' + path, False),
- Handler(Request.ForTest(base)).Get().GetRedirect(),
- '%s did not (temporarily) redirect to %s.html' % (path, path))
+ ('/' + path, False), redirect_response.GetRedirect(),
+ '%s.html did not (temporarily) redirect to %s (status %s)' %
+ (path, path, redirect_response.status))
# Make sure including a channel will permanently redirect to the same
# path without a channel.
for channel in BranchUtility.GetAllChannelNames():
- redirect_result = Handler(
+ redirect_response = Handler(
Request.ForTest(posixpath.join(channel, path))).Get()
self.assertEqual(
('/' + path, True),
- redirect_result.GetRedirect(),
- '%s did not redirect to strip channel %s' % (path, channel))
+ redirect_response.GetRedirect(),
+ '%s/%s did not (permanently) redirect to %s (status %s)' %
+ (channel, path, path, redirect_response.status))
# Samples are internationalized, test some locales.
- if path.endswith('/samples.html'):
+ if path.endswith('/samples'):
for lang in ('en-US', 'es', 'ar'):
check_result(Handler(Request.ForTest(
path,
@@ -245,7 +251,7 @@ class IntegrationTest(unittest.TestCase):
@DisableLogging('warning')
def testFileNotFound(self):
- response = Handler(Request.ForTest('/extensions/notfound.html')).Get()
+ response = Handler(Request.ForTest('/extensions/notfound')).Get()
self.assertEqual(404, response.status)
if __name__ == '__main__':

Powered by Google App Engine
This is Rietveld 408576698