OLD | NEW |
---|---|
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import sys | 4 import sys |
5 | 5 |
6 from telemetry.core import util | 6 from telemetry.core import util |
7 from telemetry import decorators | 7 from telemetry import decorators |
8 from telemetry.internal.browser import browser_finder | 8 from telemetry.internal.browser import browser_finder |
9 from telemetry.internal.browser import browser_finder_exceptions | 9 from telemetry.internal.browser import browser_finder_exceptions |
10 from telemetry.internal.browser import browser_options | 10 from telemetry.internal.browser import browser_options |
11 from telemetry.internal.platform import device_finder | 11 from telemetry.internal.platform import device_finder |
12 from telemetry.internal.util import binary_manager | |
12 from telemetry.internal.util import command_line | 13 from telemetry.internal.util import command_line |
13 from telemetry.testing import browser_test_case | 14 from telemetry.testing import browser_test_case |
14 from telemetry.testing import options_for_unittests | 15 from telemetry.testing import options_for_unittests |
15 | 16 |
16 util.AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'typ') | 17 util.AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'typ') |
17 | 18 |
18 import typ | 19 import typ |
19 | 20 |
20 | 21 |
21 class RunTestsCommand(command_line.OptparseCommand): | 22 class RunTestsCommand(command_line.OptparseCommand): |
(...skipping 16 matching lines...) Expand all Loading... | |
38 def AddCommandLineArgs(cls, parser, _): | 39 def AddCommandLineArgs(cls, parser, _): |
39 parser.add_option('--repeat-count', type='int', default=1, | 40 parser.add_option('--repeat-count', type='int', default=1, |
40 help='Repeats each a provided number of times.') | 41 help='Repeats each a provided number of times.') |
41 parser.add_option('-d', '--also-run-disabled-tests', | 42 parser.add_option('-d', '--also-run-disabled-tests', |
42 dest='run_disabled_tests', | 43 dest='run_disabled_tests', |
43 action='store_true', default=False, | 44 action='store_true', default=False, |
44 help='Ignore @Disabled and @Enabled restrictions.') | 45 help='Ignore @Disabled and @Enabled restrictions.') |
45 parser.add_option('--exact-test-filter', action='store_true', default=False, | 46 parser.add_option('--exact-test-filter', action='store_true', default=False, |
46 help='Treat test filter as exact matches (default is ' | 47 help='Treat test filter as exact matches (default is ' |
47 'substring matches).') | 48 'substring matches).') |
49 parser.add_option('--client-config', dest='client_config', default=None) | |
48 | 50 |
49 typ.ArgumentParser.add_option_group(parser, | 51 typ.ArgumentParser.add_option_group(parser, |
50 "Options for running the tests", | 52 "Options for running the tests", |
51 running=True, | 53 running=True, |
52 skip=['-d', '-v', '--verbose']) | 54 skip=['-d', '-v', '--verbose']) |
53 typ.ArgumentParser.add_option_group(parser, | 55 typ.ArgumentParser.add_option_group(parser, |
54 "Options for reporting the results", | 56 "Options for reporting the results", |
55 reporting=True) | 57 reporting=True) |
56 | 58 |
57 @classmethod | 59 @classmethod |
58 def ProcessCommandLineArgs(cls, parser, args, _): | 60 def ProcessCommandLineArgs(cls, parser, args, _): |
59 # We retry failures by default unless we're running a list of tests | 61 # We retry failures by default unless we're running a list of tests |
60 # explicitly. | 62 # explicitly. |
61 if not args.retry_limit and not args.positional_args: | 63 if not args.retry_limit and not args.positional_args: |
62 args.retry_limit = 3 | 64 args.retry_limit = 3 |
63 | 65 |
66 binary_manager.InitDependencyManager(args.client_config) | |
Dirk Pranke
2015/08/13 20:30:42
You should try to avoid setting global variables a
| |
67 | |
64 try: | 68 try: |
65 possible_browser = browser_finder.FindBrowser(args) | 69 possible_browser = browser_finder.FindBrowser(args) |
66 except browser_finder_exceptions.BrowserFinderException, ex: | 70 except browser_finder_exceptions.BrowserFinderException, ex: |
67 parser.error(ex) | 71 parser.error(ex) |
68 | 72 |
69 if not possible_browser: | 73 if not possible_browser: |
70 parser.error('No browser found of type %s. Cannot run tests.\n' | 74 parser.error('No browser found of type %s. Cannot run tests.\n' |
71 'Re-run with --browser=list to see ' | 75 'Re-run with --browser=list to see ' |
72 'available browser types.' % args.browser_type) | 76 'available browser types.' % args.browser_type) |
73 | 77 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 | 180 |
177 | 181 |
178 def _TearDownProcess(child, context): # pylint: disable=W0613 | 182 def _TearDownProcess(child, context): # pylint: disable=W0613 |
179 browser_test_case.teardown_browser() | 183 browser_test_case.teardown_browser() |
180 options_for_unittests.Pop() | 184 options_for_unittests.Pop() |
181 | 185 |
182 | 186 |
183 if __name__ == '__main__': | 187 if __name__ == '__main__': |
184 ret_code = RunTestsCommand.main() | 188 ret_code = RunTestsCommand.main() |
185 sys.exit(ret_code) | 189 sys.exit(ret_code) |
OLD | NEW |