| 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 |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') | 14 _SDK_OUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out') |
| 15 | 15 |
| 16 | 16 |
| 17 def AddBuildTypeOption(option_parser): | 17 def AddBuildTypeOption(option_parser): |
| 18 """Decorates OptionParser with build type option.""" | 18 """Decorates OptionParser with build type option.""" |
| 19 default_build_type = 'Debug' | 19 default_build_type = 'Debug' |
| 20 if 'BUILDTYPE' in os.environ: | 20 if 'BUILDTYPE' in os.environ: |
| 21 default_build_type = os.environ['BUILDTYPE'] | 21 default_build_type = os.environ['BUILDTYPE'] |
| 22 option_parser.add_option('--debug', action='store_const', const='Debug', | 22 option_parser.add_option('--debug', action='store_const', const='Debug', |
| 23 dest='build_type', default=default_build_type, | 23 dest='build_type', default=default_build_type, |
| 24 help='If set, run test suites under out/Debug. ' | 24 help='If set, run test suites under out/Debug. ' |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 action='store_true', | 42 action='store_true', |
| 43 default=False, | 43 default=False, |
| 44 help=('Keep the package data when installing ' | 44 help=('Keep the package data when installing ' |
| 45 'the application.')) | 45 'the application.')) |
| 46 | 46 |
| 47 | 47 |
| 48 def ValidateInstallAPKOption(option_parser, options): | 48 def ValidateInstallAPKOption(option_parser, options): |
| 49 if not options.apk: | 49 if not options.apk: |
| 50 option_parser.error('--apk is mandatory.') | 50 option_parser.error('--apk is mandatory.') |
| 51 if not os.path.exists(options.apk): | 51 if not os.path.exists(options.apk): |
| 52 options.apk = os.path.join(constants.CHROME_DIR, | 52 options.apk = os.path.join(constants.DIR_SOURCE_ROOT, |
| 53 'out', options.build_type, | 53 'out', options.build_type, |
| 54 'apks', options.apk) | 54 'apks', options.apk) |
| 55 | 55 |
| 56 | 56 |
| 57 def AddTestRunnerOptions(option_parser, default_timeout=60): | 57 def AddTestRunnerOptions(option_parser, default_timeout=60): |
| 58 """Decorates OptionParser with options applicable to all tests.""" | 58 """Decorates OptionParser with options applicable to all tests.""" |
| 59 | 59 |
| 60 option_parser.add_option('-t', dest='timeout', | 60 option_parser.add_option('-t', dest='timeout', |
| 61 help='Timeout to wait for each test', | 61 help='Timeout to wait for each test', |
| 62 type='int', | 62 type='int', |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 # The dexed JAR is fully qualified, assume the info JAR lives along side. | 282 # The dexed JAR is fully qualified, assume the info JAR lives along side. |
| 283 options.uiautomator_jar = options.test_jar | 283 options.uiautomator_jar = options.test_jar |
| 284 else: | 284 else: |
| 285 options.uiautomator_jar = os.path.join( | 285 options.uiautomator_jar = os.path.join( |
| 286 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_JAVALIB_DIR, | 286 _SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_JAVALIB_DIR, |
| 287 '%s.dex.jar' % options.test_jar) | 287 '%s.dex.jar' % options.test_jar) |
| 288 options.uiautomator_info_jar = ( | 288 options.uiautomator_info_jar = ( |
| 289 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + | 289 options.uiautomator_jar[:options.uiautomator_jar.find('.dex.jar')] + |
| 290 '_java.jar') | 290 '_java.jar') |
| 291 | 291 |
| OLD | NEW |