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

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

Issue 15087006: Docserver: there is only one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better redirects 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/integration_test.py
diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py
index 2ed80f33d1c1558614e6fcf458555314987abba8..77bc69d83e90dd60993e628a095254495c5174e0 100755
--- a/chrome/common/extensions/docs/server2/integration_test.py
+++ b/chrome/common/extensions/docs/server2/integration_test.py
@@ -11,10 +11,12 @@ build_server.main()
import logging
import optparse
import os
+import posixpath
import sys
import time
import unittest
+from branch_utility import BranchUtility
from local_renderer import LocalRenderer
from fake_fetchers import ConfigureFakeFetchers
from handler import Handler
@@ -74,7 +76,23 @@ class IntegrationTest(unittest.TestCase):
# that render large files. At least it'll catch zero-length responses.
self.assertTrue(len(response.content) >= len(content),
'Content was "%s" when rendering %s' % (response.content, path))
+
check_result(Handler(Request.ForTest(path)).Get())
+
+ # Make sure that leaving out the .html will temporarily redirect to the
+ # path with the .html.
+ if path != '/404.html':
+ redirect_result = Handler(
+ Request.ForTest(posixpath.splitext(path)[0])).Get()
+ self.assertEqual((path, False), redirect_result.GetRedirect())
+
+ # Make sure including a channel will permanently redirect to the same
+ # path without a channel.
+ for channel in BranchUtility.GetAllChannelNames():
+ redirect_result = Handler(
+ Request.ForTest('%s/%s' % (channel, path))).Get()
+ self.assertEqual((path, True), redirect_result.GetRedirect())
+
# Samples are internationalized, test some locales.
if path.endswith('/samples.html'):
for lang in ['en-US', 'es', 'ar']:

Powered by Google App Engine
This is Rietveld 408576698