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

Side by Side Diff: chrome/common/extensions/docs/server2/integration_test.py

Issue 600073002: Docserver: Run tasks in testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Run build_server so that files needed by tests are copied to the local 6 # Run build_server so that files needed by tests are copied to the local
7 # third_party directory. 7 # third_party directory.
8 import build_server 8 import build_server
9 build_server.main() 9 build_server.main()
10 10
11 import json 11 import json
12 import optparse 12 import optparse
13 import os 13 import os
14 import posixpath 14 import posixpath
15 import sys 15 import sys
16 import time 16 import time
17 import unittest 17 import unittest
18 18
19 from appengine_wrappers import SetTaskRunnerForTest
19 from branch_utility import BranchUtility 20 from branch_utility import BranchUtility
20 from chroot_file_system import ChrootFileSystem 21 from chroot_file_system import ChrootFileSystem
21 from extensions_paths import ( 22 from extensions_paths import (
22 CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES) 23 CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES)
23 from fake_fetchers import ConfigureFakeFetchers 24 from fake_fetchers import ConfigureFakeFetchers
24 from special_paths import SITE_VERIFICATION_FILE 25 from special_paths import SITE_VERIFICATION_FILE
25 from handler import Handler 26 from handler import Handler
26 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks 27 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks
27 from local_file_system import LocalFileSystem 28 from local_file_system import LocalFileSystem
28 from local_renderer import LocalRenderer 29 from local_renderer import LocalRenderer
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ConfigureFakeFetchers() 86 ConfigureFakeFetchers()
86 87
87 @EnableLogging('info') 88 @EnableLogging('info')
88 def testCronAndPublicFiles(self): 89 def testCronAndPublicFiles(self):
89 '''Runs cron then requests every public file. Cron needs to be run first 90 '''Runs cron then requests every public file. Cron needs to be run first
90 because the public file requests are offline. 91 because the public file requests are offline.
91 ''' 92 '''
92 if _EXPLICIT_TEST_FILES is not None: 93 if _EXPLICIT_TEST_FILES is not None:
93 return 94 return
94 95
96
97 def task_runner(url, commit=None):
98 arguments = { 'commit': commit } if commit else {}
99 Handler(Request.ForTest(url, arguments=arguments)).Get()
100
101 SetTaskRunnerForTest(task_runner)
102
95 print('Running cron...') 103 print('Running cron...')
96 start_time = time.time() 104 start_time = time.time()
97 try: 105 try:
98 response = Handler(Request.ForTest('/_cron')).Get() 106 response = Handler(Request.ForTest('/_cron')).Get()
99 if response: 107 if response:
100 self.assertEqual(200, response.status) 108 self.assertEqual(200, response.status)
101 self.assertEqual('Success', response.content.ToString()) 109 self.assertEqual('Success', response.content.ToString())
102 else: 110 else:
103 self.fail('No response for _cron') 111 self.fail('No response for _cron')
104 finally: 112 finally:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 parser.add_option('-v', '--verbose', action='store_true', default=False, 282 parser.add_option('-v', '--verbose', action='store_true', default=False,
275 help='Show verbose output like currently broken links') 283 help='Show verbose output like currently broken links')
276 (opts, args) = parser.parse_args() 284 (opts, args) = parser.parse_args()
277 if not opts.all: 285 if not opts.all:
278 _EXPLICIT_TEST_FILES = args 286 _EXPLICIT_TEST_FILES = args
279 _REBASE = opts.rebase 287 _REBASE = opts.rebase
280 _VERBOSE = opts.verbose 288 _VERBOSE = opts.verbose
281 # Kill sys.argv because we have our own flags. 289 # Kill sys.argv because we have our own flags.
282 sys.argv = [sys.argv[0]] 290 sys.argv = [sys.argv[0]]
283 unittest.main() 291 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/appengine_wrappers.py ('k') | chrome/common/extensions/docs/server2/servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698