| 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 #TODO(craigdh): pylib/utils/ should not depend on pylib/. | 7 #TODO(craigdh): pylib/utils/ should not depend on pylib/. |
| 8 from pylib import constants | 8 from pylib import constants |
| 9 | 9 |
| 10 import optparse | 10 import optparse |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 def AddInstallAPKOption(option_parser): | 31 def AddInstallAPKOption(option_parser): |
| 32 """Decorates OptionParser with apk option used to install the APK.""" | 32 """Decorates OptionParser with apk option used to install the APK.""" |
| 33 AddBuildTypeOption(option_parser) | 33 AddBuildTypeOption(option_parser) |
| 34 option_parser.add_option('--apk', | 34 option_parser.add_option('--apk', |
| 35 help=('The name of the apk containing the ' | 35 help=('The name of the apk containing the ' |
| 36 ' application (with the .apk extension).')) | 36 ' application (with the .apk extension).')) |
| 37 option_parser.add_option('--apk_package', | 37 option_parser.add_option('--apk_package', |
| 38 help=('The package name used by the apk containing ' | 38 help=('The package name used by the apk containing ' |
| 39 'the application.')) | 39 'the application.')) |
| 40 option_parser.add_option('--keep_data', |
| 41 action='store_true', |
| 42 default=False, |
| 43 help=('Keep the package data when installing ' |
| 44 'the application.')) |
| 40 | 45 |
| 41 | 46 |
| 42 def ValidateInstallAPKOption(option_parser, options): | 47 def ValidateInstallAPKOption(option_parser, options): |
| 43 if not options.apk: | 48 if not options.apk: |
| 44 option_parser.error('--apk is mandatory.') | 49 option_parser.error('--apk is mandatory.') |
| 45 if not os.path.exists(options.apk): | 50 if not os.path.exists(options.apk): |
| 46 options.apk = os.path.join(constants.CHROME_DIR, | 51 options.apk = os.path.join(constants.CHROME_DIR, |
| 47 'out', options.build_type, | 52 'out', options.build_type, |
| 48 'apks', options.apk) | 53 'apks', options.apk) |
| 49 | 54 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 '%s.apk' % options.test_apk) | 227 '%s.apk' % options.test_apk) |
| 223 options.test_apk_jar_path = os.path.join( | 228 options.test_apk_jar_path = os.path.join( |
| 224 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, | 229 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
| 225 '%s.jar' % options.test_apk) | 230 '%s.jar' % options.test_apk) |
| 226 if options.annotation_str: | 231 if options.annotation_str: |
| 227 options.annotation = options.annotation_str.split() | 232 options.annotation = options.annotation_str.split() |
| 228 elif options.test_filter: | 233 elif options.test_filter: |
| 229 options.annotation = [] | 234 options.annotation = [] |
| 230 else: | 235 else: |
| 231 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] | 236 options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest'] |
| OLD | NEW |