| 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 e833f73d6c14669bfea6a4f453df60f033f3f5d0..1b9ac89ede34c7174f9f23cb25770f5fabaff8e5 100755
|
| --- a/chrome/common/extensions/docs/server2/integration_test.py
|
| +++ b/chrome/common/extensions/docs/server2/integration_test.py
|
| @@ -3,8 +3,6 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -from __future__ import print_function
|
| -
|
| # Run build_server so that files needed by tests are copied to the local
|
| # third_party directory.
|
| import build_server
|
| @@ -19,8 +17,7 @@ import unittest
|
|
|
| from cron_servlet import CronServlet
|
| from local_renderer import LocalRenderer
|
| -from render_servlet import AlwaysOnline
|
| -from test_util import DisableLogging
|
| +from test_util import EnableLogging, DisableLogging
|
|
|
| # Arguments set up if __main__ specifies them.
|
| _BASE_PATH = os.path.join(
|
| @@ -44,6 +41,7 @@ class IntegrationTest(unittest.TestCase):
|
| def setUp(self):
|
| self._renderer = LocalRenderer(_BASE_PATH)
|
|
|
| + @EnableLogging('info')
|
| def testCronAndPublicFiles(self):
|
| '''Runs cron then requests every public file. Cron needs to be run first
|
| because the public file requests are offline.
|
| @@ -54,13 +52,10 @@ class IntegrationTest(unittest.TestCase):
|
| print('Running cron...')
|
| start_time = time.time()
|
| try:
|
| - logging_info = logging.info
|
| - logging.info = print
|
| response = self._renderer.Render('/stable', servlet=CronServlet)
|
| self.assertEqual(200, response.status)
|
| self.assertEqual('Success', response.content.ToString())
|
| finally:
|
| - logging.info = logging_info
|
| print('Took %s seconds' % (time.time() - start_time))
|
|
|
| public_files = _GetPublicFiles()
|
| @@ -76,16 +71,17 @@ 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(self._renderer.Render(path))
|
| + check_result(self._renderer.Render(path, offline=True))
|
| # Samples are internationalized, test some locales.
|
| if path.endswith('/samples.html'):
|
| for lang in ['en-US', 'es', 'ar']:
|
| check_result(self._renderer.Render(
|
| - path, headers={'Accept-Language': '%s;q=0.8' % lang}))
|
| + path,
|
| + headers={'Accept-Language': '%s;q=0.8' % lang},
|
| + offline=True))
|
| finally:
|
| print('Took %s seconds' % (time.time() - start_time))
|
|
|
| - @AlwaysOnline
|
| def testExplicitFiles(self):
|
| '''Tests just the files in _EXPLICIT_TEST_FILES.
|
| '''
|
| @@ -102,7 +98,6 @@ class IntegrationTest(unittest.TestCase):
|
| print('Took %s seconds' % (time.time() - start_time))
|
|
|
| @DisableLogging('warning')
|
| - @AlwaysOnline
|
| def testFileNotFound(self):
|
| response = self._renderer.Render('/extensions/notfound.html')
|
| self.assertEqual(404, response.status)
|
|
|