| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
| 5 """Parses the command line, discovers the appropriate tests, and runs them. | 5 """Parses the command line, discovers the appropriate tests, and runs them. |
| 6 | 6 |
| 7 Handles test configuration, but all the logic for | 7 Handles test configuration, but all the logic for |
| 8 actually running the test is in Test and PageRunner.""" | 8 actually running the test is in Test and PageRunner.""" |
| 9 | 9 |
| 10 import hashlib | 10 import hashlib |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if not args.positional_args: | 82 if not args.positional_args: |
| 83 args.tests = _Tests() | 83 args.tests = _Tests() |
| 84 elif len(args.positional_args) == 1: | 84 elif len(args.positional_args) == 1: |
| 85 args.tests = _MatchTestName(args.positional_args[0], exact_matches=False) | 85 args.tests = _MatchTestName(args.positional_args[0], exact_matches=False) |
| 86 else: | 86 else: |
| 87 parser.error('Must provide at most one test name.') | 87 parser.error('Must provide at most one test name.') |
| 88 | 88 |
| 89 def Run(self, args): | 89 def Run(self, args): |
| 90 if args.json_output_file: | 90 if args.json_output_file: |
| 91 possible_browser = browser_finder.FindBrowser(args) | 91 possible_browser = browser_finder.FindBrowser(args) |
| 92 args.browser_type = 'reference' | 92 if args.browser_type in ( |
| 93 possible_reference_browser = browser_finder.FindBrowser(args) | 93 'exact', 'release', 'release_x64', 'debug', 'debug_x64', 'canary'): |
| 94 args.browser_type = 'reference' |
| 95 possible_reference_browser = browser_finder.FindBrowser(args) |
| 96 else: |
| 97 possible_reference_browser = None |
| 94 with open(args.json_output_file, 'w') as f: | 98 with open(args.json_output_file, 'w') as f: |
| 95 f.write(_GetJsonTestList(possible_browser, possible_reference_browser, | 99 f.write(_GetJsonTestList(possible_browser, possible_reference_browser, |
| 96 args.tests, args.num_shards)) | 100 args.tests, args.num_shards)) |
| 97 else: | 101 else: |
| 98 _PrintTestList(args.tests) | 102 _PrintTestList(args.tests) |
| 99 return 0 | 103 return 0 |
| 100 | 104 |
| 101 | 105 |
| 102 class Run(command_line.OptparseCommand): | 106 class Run(command_line.OptparseCommand): |
| 103 """Run one or more tests (default)""" | 107 """Run one or more tests (default)""" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 373 |
| 370 # Parse and run the command. | 374 # Parse and run the command. |
| 371 parser = command.CreateParser() | 375 parser = command.CreateParser() |
| 372 command.AddCommandLineArgs(parser) | 376 command.AddCommandLineArgs(parser) |
| 373 options, args = parser.parse_args() | 377 options, args = parser.parse_args() |
| 374 if commands: | 378 if commands: |
| 375 args = args[1:] | 379 args = args[1:] |
| 376 options.positional_args = args | 380 options.positional_args = args |
| 377 command.ProcessCommandLineArgs(parser, options) | 381 command.ProcessCommandLineArgs(parser, options) |
| 378 return command().Run(options) | 382 return command().Run(options) |
| OLD | NEW |