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 """Defines a set of constants shared by test runners and other scripts.""" | 5 """Defines a set of constants shared by test runners and other scripts.""" |
6 | 6 |
7 # TODO(jbudorick): Split these constants into coherent modules. | 7 # TODO(jbudorick): Split these constants into coherent modules. |
8 | 8 |
9 # pylint: disable=W0212 | 9 # pylint: disable=W0212 |
10 | 10 |
11 import collections | 11 import collections |
12 import logging | 12 import logging |
13 import os | 13 import os |
14 import subprocess | 14 import subprocess |
15 | 15 |
16 import devil.android.sdk.keyevent | 16 import devil.android.sdk.keyevent |
17 from devil.android.sdk import version_codes | 17 from devil.android.sdk import version_codes |
| 18 from devil.constants import exit_codes |
18 | 19 |
19 keyevent = devil.android.sdk.keyevent | 20 keyevent = devil.android.sdk.keyevent |
20 | 21 |
21 | 22 |
22 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', | 23 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', |
23 os.path.abspath(os.path.join(os.path.dirname(__file__), | 24 os.path.abspath(os.path.join(os.path.dirname(__file__), |
24 os.pardir, os.pardir, os.pardir, os.pardir))) | 25 os.pardir, os.pardir, os.pardir, os.pardir))) |
25 | 26 |
26 PackageInfo = collections.namedtuple('PackageInfo', | 27 PackageInfo = collections.namedtuple('PackageInfo', |
27 ['package', 'activity', 'cmdline_file', 'devtools_socket', | 28 ['package', 'activity', 'cmdline_file', 'devtools_socket', |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 # set it here. | 274 # set it here. |
274 try: | 275 try: |
275 with file(os.devnull, 'w') as devnull: | 276 with file(os.devnull, 'w') as devnull: |
276 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 277 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
277 return 'adb' | 278 return 'adb' |
278 except OSError: | 279 except OSError: |
279 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 280 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
280 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 281 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
281 | 282 |
282 # Exit codes | 283 # Exit codes |
283 ERROR_EXIT_CODE = 1 | 284 ERROR_EXIT_CODE = exit_codes.ERROR |
284 INFRA_EXIT_CODE = 87 | 285 INFRA_EXIT_CODE = exit_codes.INFRA |
285 WARNING_EXIT_CODE = 88 | 286 WARNING_EXIT_CODE = exit_codes.WARNING |
OLD | NEW |