| OLD | NEW |
| 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 branch_utility import BranchUtility | 19 from branch_utility import BranchUtility |
| 20 from chroot_file_system import ChrootFileSystem | 20 from chroot_file_system import ChrootFileSystem |
| 21 from extensions_paths import CONTENT_PROVIDERS, EXTENSIONS, PUBLIC_TEMPLATES | 21 from extensions_paths import ( |
| 22 CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES) |
| 22 from fake_fetchers import ConfigureFakeFetchers | 23 from fake_fetchers import ConfigureFakeFetchers |
| 23 from special_paths import SITE_VERIFICATION_FILE | 24 from special_paths import SITE_VERIFICATION_FILE |
| 24 from handler import Handler | 25 from handler import Handler |
| 25 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks | 26 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks |
| 26 from local_file_system import LocalFileSystem | 27 from local_file_system import LocalFileSystem |
| 27 from local_renderer import LocalRenderer | 28 from local_renderer import LocalRenderer |
| 28 from path_util import AssertIsValid | 29 from path_util import AssertIsValid |
| 29 from servlet import Request | 30 from servlet import Request |
| 30 from third_party.json_schema_compiler import json_parse | 31 from third_party.json_schema_compiler import json_parse |
| 31 from test_util import ( | 32 from test_util import ( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 print('Took %s seconds' % (time.time() - start_time)) | 105 print('Took %s seconds' % (time.time() - start_time)) |
| 105 | 106 |
| 106 # TODO(kalman): Re-enable this, but it takes about an hour at the moment, | 107 # TODO(kalman): Re-enable this, but it takes about an hour at the moment, |
| 107 # presumably because every page now has a lot of links on it from the | 108 # presumably because every page now has a lot of links on it from the |
| 108 # topnav. | 109 # topnav. |
| 109 | 110 |
| 110 #print("Checking for broken links...") | 111 #print("Checking for broken links...") |
| 111 #start_time = time.time() | 112 #start_time = time.time() |
| 112 #link_error_detector = LinkErrorDetector( | 113 #link_error_detector = LinkErrorDetector( |
| 113 # # TODO(kalman): Use of ChrootFileSystem here indicates a hack. Fix. | 114 # # TODO(kalman): Use of ChrootFileSystem here indicates a hack. Fix. |
| 114 # ChrootFileSystem(LocalFileSystem.Create(), EXTENSIONS), | 115 # ChrootFileSystem(LocalFileSystem.Create(), CHROME_EXTENSIONS), |
| 115 # lambda path: Handler(Request.ForTest(path)).Get(), | 116 # lambda path: Handler(Request.ForTest(path)).Get(), |
| 116 # 'templates/public', | 117 # 'templates/public', |
| 117 # ('extensions/index.html', 'apps/about_apps.html')) | 118 # ('extensions/index.html', 'apps/about_apps.html')) |
| 118 | 119 |
| 119 #broken_links = link_error_detector.GetBrokenLinks() | 120 #broken_links = link_error_detector.GetBrokenLinks() |
| 120 #if broken_links: | 121 #if broken_links: |
| 121 # print('Found %d broken links.' % ( | 122 # print('Found %d broken links.' % ( |
| 122 # len(broken_links))) | 123 # len(broken_links))) |
| 123 # if _VERBOSE: | 124 # if _VERBOSE: |
| 124 # print(StringifyBrokenLinks(broken_links)) | 125 # print(StringifyBrokenLinks(broken_links)) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 parser.add_option('-v', '--verbose', action='store_true', default=False, | 274 parser.add_option('-v', '--verbose', action='store_true', default=False, |
| 274 help='Show verbose output like currently broken links') | 275 help='Show verbose output like currently broken links') |
| 275 (opts, args) = parser.parse_args() | 276 (opts, args) = parser.parse_args() |
| 276 if not opts.all: | 277 if not opts.all: |
| 277 _EXPLICIT_TEST_FILES = args | 278 _EXPLICIT_TEST_FILES = args |
| 278 _REBASE = opts.rebase | 279 _REBASE = opts.rebase |
| 279 _VERBOSE = opts.verbose | 280 _VERBOSE = opts.verbose |
| 280 # Kill sys.argv because we have our own flags. | 281 # Kill sys.argv because we have our own flags. |
| 281 sys.argv = [sys.argv[0]] | 282 sys.argv = [sys.argv[0]] |
| 282 unittest.main() | 283 unittest.main() |
| OLD | NEW |