| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 | 4 |
| 5 """Parses options for the instrumentation tests.""" | 5 """Parses options for the instrumentation tests.""" |
| 6 | 6 |
| 7 import constants | 7 import constants |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 dest='build_type', default=default_build_type, | 21 dest='build_type', default=default_build_type, |
| 22 help='If set, run test suites under out/Debug. ' | 22 help='If set, run test suites under out/Debug. ' |
| 23 'Default is env var BUILDTYPE or Debug') | 23 'Default is env var BUILDTYPE or Debug') |
| 24 option_parser.add_option('--release', action='store_const', const='Release', | 24 option_parser.add_option('--release', action='store_const', const='Release', |
| 25 dest='build_type', | 25 dest='build_type', |
| 26 help='If set, run test suites under out/Release. ' | 26 help='If set, run test suites under out/Release. ' |
| 27 'Default is env var BUILDTYPE or Debug.') | 27 'Default is env var BUILDTYPE or Debug.') |
| 28 | 28 |
| 29 def AddInstallAPKOption(option_parser): | 29 def AddInstallAPKOption(option_parser): |
| 30 """Decorates OptionParser with apk option used to install the APK.""" | 30 """Decorates OptionParser with apk option used to install the APK.""" |
| 31 AddBuildTypeOption(option_parser) |
| 31 option_parser.add_option('--apk', | 32 option_parser.add_option('--apk', |
| 32 help=('The name of the apk containing the ' | 33 help=('The name of the apk containing the ' |
| 33 ' application (with the .apk extension).')) | 34 ' application (with the .apk extension).')) |
| 34 option_parser.add_option('--apk_package', | 35 option_parser.add_option('--apk_package', |
| 35 help=('The package name used by the apk containing ' | 36 help=('The package name used by the apk containing ' |
| 36 'the application.')) | 37 'the application.')) |
| 37 | 38 |
| 39 |
| 40 def ValidateInstallAPKOption(option_parser, options): |
| 41 if not options.apk: |
| 42 option_parser.error('--apk is mandatory.') |
| 43 if not os.path.exists(options.apk): |
| 44 options.apk = os.path.join(os.environ['CHROME_SRC'], |
| 45 'out', options.build_type, |
| 46 'apks', options.apk) |
| 47 |
| 48 |
| 38 def AddTestRunnerOptions(option_parser, default_timeout=60): | 49 def AddTestRunnerOptions(option_parser, default_timeout=60): |
| 39 """Decorates OptionParser with options applicable to all tests.""" | 50 """Decorates OptionParser with options applicable to all tests.""" |
| 40 | 51 |
| 41 option_parser.add_option('-t', dest='timeout', | 52 option_parser.add_option('-t', dest='timeout', |
| 42 help='Timeout to wait for each test', | 53 help='Timeout to wait for each test', |
| 43 type='int', | 54 type='int', |
| 44 default=default_timeout) | 55 default=default_timeout) |
| 45 option_parser.add_option('-c', dest='cleanup_test_files', | 56 option_parser.add_option('-c', dest='cleanup_test_files', |
| 46 help='Cleanup test files on the device after run', | 57 help='Cleanup test files on the device after run', |
| 47 action='store_true') | 58 action='store_true') |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 '%s.apk' % options.test_apk) | 166 '%s.apk' % options.test_apk) |
| 156 options.test_apk_jar_path = os.path.join( | 167 options.test_apk_jar_path = os.path.join( |
| 157 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, | 168 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
| 158 '%s.jar' % options.test_apk) | 169 '%s.jar' % options.test_apk) |
| 159 if options.annotation_str: | 170 if options.annotation_str: |
| 160 options.annotation = options.annotation_str.split() | 171 options.annotation = options.annotation_str.split() |
| 161 elif options.test_filter: | 172 elif options.test_filter: |
| 162 options.annotation = [] | 173 options.annotation = [] |
| 163 else: | 174 else: |
| 164 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 175 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
| OLD | NEW |