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

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

Issue 1151283007: Docserver overhaul: Gitiles away from me. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove inform_users template to fix presubmit failure (it's now a redirect) Created 5 years, 6 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 import update_cache
18 19
19 from appengine_wrappers import SetTaskRunnerForTest
20 from branch_utility import BranchUtility 20 from branch_utility import BranchUtility
21 from chroot_file_system import ChrootFileSystem 21 from chroot_file_system import ChrootFileSystem
22 from extensions_paths import ( 22 from extensions_paths import (
23 CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES) 23 CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES)
24 from fake_fetchers import ConfigureFakeFetchers 24 from fake_fetchers import ConfigureFakeFetchers
25 from special_paths import SITE_VERIFICATION_FILE 25 from special_paths import SITE_VERIFICATION_FILE
26 from handler import Handler 26 from handler import Handler
27 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks 27 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks
28 from local_file_system import LocalFileSystem 28 from local_file_system import LocalFileSystem
29 from local_renderer import LocalRenderer 29 from local_renderer import LocalRenderer
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public_files.update(walk(content_provider['chromium']['dir'], 79 public_files.update(walk(content_provider['chromium']['dir'],
80 prefix=content_provider['serveFrom'])) 80 prefix=content_provider['serveFrom']))
81 return public_files 81 return public_files
82 82
83 83
84 class IntegrationTest(unittest.TestCase): 84 class IntegrationTest(unittest.TestCase):
85 def setUp(self): 85 def setUp(self):
86 ConfigureFakeFetchers() 86 ConfigureFakeFetchers()
87 87
88 @EnableLogging('info') 88 @EnableLogging('info')
89 def testCronAndPublicFiles(self): 89 def testUpdateAndPublicFiles(self):
90 '''Runs cron then requests every public file. Cron needs to be run first 90 '''Runs update then requests every public file. Update needs to be run first
91 because the public file requests are offline. 91 because the public file requests are offline.
92 ''' 92 '''
93 if _EXPLICIT_TEST_FILES is not None: 93 if _EXPLICIT_TEST_FILES is not None:
94 return 94 return
95 95
96 96 print('Running update...')
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
103 print('Running cron...')
104 start_time = time.time() 97 start_time = time.time()
105 try: 98 try:
106 response = Handler(Request.ForTest('/_cron')).Get() 99 update_cache.UpdateCache()
107 if response:
108 self.assertEqual(200, response.status)
109 self.assertEqual('Success', response.content.ToString())
110 else:
111 self.fail('No response for _cron')
112 finally: 100 finally:
113 print('Took %s seconds' % (time.time() - start_time)) 101 print('Took %s seconds' % (time.time() - start_time))
114 102
115 # TODO(kalman): Re-enable this, but it takes about an hour at the moment, 103 # TODO(kalman): Re-enable this, but it takes about an hour at the moment,
116 # presumably because every page now has a lot of links on it from the 104 # presumably because every page now has a lot of links on it from the
117 # topnav. 105 # topnav.
118 106
119 #print("Checking for broken links...") 107 #print("Checking for broken links...")
120 #start_time = time.time() 108 #start_time = time.time()
121 #link_error_detector = LinkErrorDetector( 109 #link_error_detector = LinkErrorDetector(
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 parser.add_option('-v', '--verbose', action='store_true', default=False, 274 parser.add_option('-v', '--verbose', action='store_true', default=False,
287 help='Show verbose output like currently broken links') 275 help='Show verbose output like currently broken links')
288 (opts, args) = parser.parse_args() 276 (opts, args) = parser.parse_args()
289 if not opts.all: 277 if not opts.all:
290 _EXPLICIT_TEST_FILES = args 278 _EXPLICIT_TEST_FILES = args
291 _REBASE = opts.rebase 279 _REBASE = opts.rebase
292 _VERBOSE = opts.verbose 280 _VERBOSE = opts.verbose
293 # Kill sys.argv because we have our own flags. 281 # Kill sys.argv because we have our own flags.
294 sys.argv = [sys.argv[0]] 282 sys.argv = [sys.argv[0]]
295 unittest.main() 283 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698