| 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 23 matching lines...) Expand all Loading... |
| 34 ' application (with the .apk extension).')) | 34 ' application (with the .apk extension).')) |
| 35 option_parser.add_option('--apk_package', | 35 option_parser.add_option('--apk_package', |
| 36 help=('The package name used by the apk containing ' | 36 help=('The package name used by the apk containing ' |
| 37 'the application.')) | 37 'the application.')) |
| 38 | 38 |
| 39 | 39 |
| 40 def ValidateInstallAPKOption(option_parser, options): | 40 def ValidateInstallAPKOption(option_parser, options): |
| 41 if not options.apk: | 41 if not options.apk: |
| 42 option_parser.error('--apk is mandatory.') | 42 option_parser.error('--apk is mandatory.') |
| 43 if not os.path.exists(options.apk): | 43 if not os.path.exists(options.apk): |
| 44 options.apk = os.path.join(os.environ['CHROME_SRC'], | 44 options.apk = os.path.join(constants.CHROME_DIR, |
| 45 'out', options.build_type, | 45 'out', options.build_type, |
| 46 'apks', options.apk) | 46 'apks', options.apk) |
| 47 | 47 |
| 48 | 48 |
| 49 def AddTestRunnerOptions(option_parser, default_timeout=60): | 49 def AddTestRunnerOptions(option_parser, default_timeout=60): |
| 50 """Decorates OptionParser with options applicable to all tests.""" | 50 """Decorates OptionParser with options applicable to all tests.""" |
| 51 | 51 |
| 52 option_parser.add_option('-t', dest='timeout', | 52 option_parser.add_option('-t', dest='timeout', |
| 53 help='Timeout to wait for each test', | 53 help='Timeout to wait for each test', |
| 54 type='int', | 54 type='int', |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 '%s.apk' % options.test_apk) | 176 '%s.apk' % options.test_apk) |
| 177 options.test_apk_jar_path = os.path.join( | 177 options.test_apk_jar_path = os.path.join( |
| 178 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, | 178 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
| 179 '%s.jar' % options.test_apk) | 179 '%s.jar' % options.test_apk) |
| 180 if options.annotation_str: | 180 if options.annotation_str: |
| 181 options.annotation = options.annotation_str.split() | 181 options.annotation = options.annotation_str.split() |
| 182 elif options.test_filter: | 182 elif options.test_filter: |
| 183 options.annotation = [] | 183 options.annotation = [] |
| 184 else: | 184 else: |
| 185 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 185 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
| OLD | NEW |