Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 'which the tests are running. [experimental]')) | 94 'which the tests are running. [experimental]')) |
| 95 group.add_argument('-e', '--environment', default='local', | 95 group.add_argument('-e', '--environment', default='local', |
| 96 choices=constants.VALID_ENVIRONMENTS, | 96 choices=constants.VALID_ENVIRONMENTS, |
| 97 help='Test environment to run in (default: %(default)s).') | 97 help='Test environment to run in (default: %(default)s).') |
| 98 group.add_argument('--adb-path', | 98 group.add_argument('--adb-path', |
| 99 help=('Specify the absolute path of the adb binary that ' | 99 help=('Specify the absolute path of the adb binary that ' |
| 100 'should be used.')) | 100 'should be used.')) |
| 101 group.add_argument('--json-results-file', dest='json_results_file', | 101 group.add_argument('--json-results-file', dest='json_results_file', |
| 102 help='If set, will dump results in JSON form ' | 102 help='If set, will dump results in JSON form ' |
| 103 'to specified file.') | 103 'to specified file.') |
| 104 | 104 group.add_argument('--device-type', default='Android', |
|
jbudorick
2015/01/09 22:06:50
use the choices kwarg. we can probably put a VALID
rnephew (Wrong account)
2015/01/09 23:35:36
Done.
| |
| 105 help=('Type of device to run on. iOS or android')) | |
| 105 | 106 |
| 106 def ProcessCommonOptions(args): | 107 def ProcessCommonOptions(args): |
| 107 """Processes and handles all common options.""" | 108 """Processes and handles all common options.""" |
| 108 run_tests_helper.SetLogLevel(args.verbose_count) | 109 run_tests_helper.SetLogLevel(args.verbose_count) |
| 109 constants.SetBuildType(args.build_type) | 110 constants.SetBuildType(args.build_type) |
| 110 if args.build_directory: | 111 if args.build_directory: |
| 111 constants.SetBuildDirectory(args.build_directory) | 112 constants.SetBuildDirectory(args.build_directory) |
| 112 if args.output_directory: | 113 if args.output_directory: |
| 113 constants.SetOutputDirectort(args.output_directory) | 114 constants.SetOutputDirectort(args.output_directory) |
| 114 if args.adb_path: | 115 if args.adb_path: |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 135 group.add_argument('--results-path', default='', | 136 group.add_argument('--results-path', default='', |
| 136 help=('File path to download results to.')) | 137 help=('File path to download results to.')) |
| 137 group.add_argument('--api-protocol', | 138 group.add_argument('--api-protocol', |
| 138 help=('HTTP protocol to use. (http or https)')) | 139 help=('HTTP protocol to use. (http or https)')) |
| 139 group.add_argument('--api-address', help=('Address to send HTTP requests.')) | 140 group.add_argument('--api-address', help=('Address to send HTTP requests.')) |
| 140 group.add_argument('--api-port', help=('Port to send HTTP requests to.')) | 141 group.add_argument('--api-port', help=('Port to send HTTP requests to.')) |
| 141 group.add_argument('--runner-type', default='', | 142 group.add_argument('--runner-type', default='', |
| 142 help=('Type of test to run as.')) | 143 help=('Type of test to run as.')) |
| 143 group.add_argument('--runner-package', default='', | 144 group.add_argument('--runner-package', default='', |
| 144 help=('Package name of test.')) | 145 help=('Package name of test.')) |
| 145 group.add_argument('--apk-under-test', default='apks/Chrome.apk', | 146 group.add_argument('--app-under-test', default='', |
| 146 help=('APK to run tests on.')) | 147 help=('APK to run tests on.')) |
| 147 | 148 |
| 148 api_secret_group = group.add_mutually_exclusive_group() | 149 api_secret_group = group.add_mutually_exclusive_group() |
| 149 api_secret_group.add_argument('--api-secret', default='', | 150 api_secret_group.add_argument('--api-secret', default='', |
| 150 help=('API secret for remote devices.')) | 151 help=('API secret for remote devices.')) |
| 151 api_secret_group.add_argument('--api-secret-file', default='', | 152 api_secret_group.add_argument('--api-secret-file', default='', |
| 152 help=('Path to file that contains API secret.')) | 153 help=('Path to file that contains API secret.')) |
| 153 | 154 |
| 154 api_key_group = group.add_mutually_exclusive_group() | 155 api_key_group = group.add_mutually_exclusive_group() |
| 155 api_key_group.add_argument('--api-key', default='', | 156 api_key_group.add_argument('--api-key', default='', |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 subparser = command_parsers.add_parser( | 982 subparser = command_parsers.add_parser( |
| 982 test_type, usage='%(prog)s [options]', help=config.help_txt) | 983 test_type, usage='%(prog)s [options]', help=config.help_txt) |
| 983 config.add_options_func(subparser) | 984 config.add_options_func(subparser) |
| 984 | 985 |
| 985 args = parser.parse_args() | 986 args = parser.parse_args() |
| 986 return RunTestsCommand(args, parser) | 987 return RunTestsCommand(args, parser) |
| 987 | 988 |
| 988 | 989 |
| 989 if __name__ == '__main__': | 990 if __name__ == '__main__': |
| 990 sys.exit(main()) | 991 sys.exit(main()) |
| OLD | NEW |