| 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 |
| 18 |
| 17 keyevent = devil.android.sdk.keyevent | 19 keyevent = devil.android.sdk.keyevent |
| 18 | 20 |
| 19 | 21 |
| 20 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', | 22 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', |
| 21 os.path.abspath(os.path.join(os.path.dirname(__file__), | 23 os.path.abspath(os.path.join(os.path.dirname(__file__), |
| 22 os.pardir, os.pardir, os.pardir, os.pardir))) | 24 os.pardir, os.pardir, os.pardir, os.pardir))) |
| 23 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') | 25 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') |
| 24 | 26 |
| 25 PackageInfo = collections.namedtuple('PackageInfo', | 27 PackageInfo = collections.namedtuple('PackageInfo', |
| 26 ['package', 'activity', 'cmdline_file', 'devtools_socket', | 28 ['package', 'activity', 'cmdline_file', 'devtools_socket', |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 163 |
| 162 ADB_KEYS_FILE = '/data/misc/adb/adb_keys' | 164 ADB_KEYS_FILE = '/data/misc/adb/adb_keys' |
| 163 | 165 |
| 164 PERF_OUTPUT_DIR = os.path.join(DIR_SOURCE_ROOT, 'out', 'step_results') | 166 PERF_OUTPUT_DIR = os.path.join(DIR_SOURCE_ROOT, 'out', 'step_results') |
| 165 # The directory on the device where perf test output gets saved to. | 167 # The directory on the device where perf test output gets saved to. |
| 166 DEVICE_PERF_OUTPUT_DIR = ( | 168 DEVICE_PERF_OUTPUT_DIR = ( |
| 167 '/data/data/' + PACKAGE_INFO['chrome'].package + '/files') | 169 '/data/data/' + PACKAGE_INFO['chrome'].package + '/files') |
| 168 | 170 |
| 169 SCREENSHOTS_DIR = os.path.join(DIR_SOURCE_ROOT, 'out_screenshots') | 171 SCREENSHOTS_DIR = os.path.join(DIR_SOURCE_ROOT, 'out_screenshots') |
| 170 | 172 |
| 171 class ANDROID_SDK_VERSION_CODES(object): | 173 ANDROID_SDK_VERSION = version_codes.MARSHMALLOW |
| 172 """Android SDK version codes. | |
| 173 | |
| 174 http://developer.android.com/reference/android/os/Build.VERSION_CODES.html | |
| 175 """ | |
| 176 | |
| 177 JELLY_BEAN = 16 | |
| 178 JELLY_BEAN_MR1 = 17 | |
| 179 JELLY_BEAN_MR2 = 18 | |
| 180 KITKAT = 19 | |
| 181 KITKAT_WATCH = 20 | |
| 182 LOLLIPOP = 21 | |
| 183 LOLLIPOP_MR1 = 22 | |
| 184 MARSHMALLOW = 23 | |
| 185 | |
| 186 ANDROID_SDK_VERSION = ANDROID_SDK_VERSION_CODES.MARSHMALLOW | |
| 187 ANDROID_SDK_BUILD_TOOLS_VERSION = '23.0.0' | 174 ANDROID_SDK_BUILD_TOOLS_VERSION = '23.0.0' |
| 188 ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, | 175 ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, |
| 189 'third_party/android_tools/sdk') | 176 'third_party/android_tools/sdk') |
| 190 ANDROID_SDK_TOOLS = os.path.join(ANDROID_SDK_ROOT, | 177 ANDROID_SDK_TOOLS = os.path.join(ANDROID_SDK_ROOT, |
| 191 'build-tools', ANDROID_SDK_BUILD_TOOLS_VERSION) | 178 'build-tools', ANDROID_SDK_BUILD_TOOLS_VERSION) |
| 192 ANDROID_NDK_ROOT = os.path.join(DIR_SOURCE_ROOT, | 179 ANDROID_NDK_ROOT = os.path.join(DIR_SOURCE_ROOT, |
| 193 'third_party/android_tools/ndk') | 180 'third_party/android_tools/ndk') |
| 194 | 181 |
| 195 PROGUARD_SCRIPT_PATH = os.path.join( | 182 PROGUARD_SCRIPT_PATH = os.path.join( |
| 196 ANDROID_SDK_ROOT, 'tools', 'proguard', 'bin', 'proguard.sh') | 183 ANDROID_SDK_ROOT, 'tools', 'proguard', 'bin', 'proguard.sh') |
| 197 | 184 |
| 198 EMULATOR_SDK_ROOT = os.environ.get('ANDROID_EMULATOR_SDK_ROOT', | 185 EMULATOR_SDK_ROOT = os.environ.get('ANDROID_EMULATOR_SDK_ROOT', |
| 199 os.path.join(DIR_SOURCE_ROOT, | 186 os.path.join(DIR_SOURCE_ROOT, |
| 200 'android_emulator_sdk')) | 187 'android_emulator_sdk')) |
| 201 | 188 |
| 202 PROGUARD_ROOT = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard') | 189 PROGUARD_ROOT = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'proguard') |
| 203 | 190 |
| 204 BAD_DEVICES_JSON = os.path.join(DIR_SOURCE_ROOT, | 191 BAD_DEVICES_JSON = os.path.join(DIR_SOURCE_ROOT, |
| 205 os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 192 os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
| 206 'bad_devices.json') | 193 'bad_devices.json') |
| 207 | 194 |
| 208 UPSTREAM_FLAKINESS_SERVER = 'test-results.appspot.com' | 195 UPSTREAM_FLAKINESS_SERVER = 'test-results.appspot.com' |
| 209 | 196 |
| 197 # TODO(jbudorick): Remove once unused. |
| 210 DEVICE_LOCAL_PROPERTIES_PATH = '/data/local.prop' | 198 DEVICE_LOCAL_PROPERTIES_PATH = '/data/local.prop' |
| 211 | 199 |
| 200 # TODO(jbudorick): Rework this into testing/buildbot/ |
| 212 PYTHON_UNIT_TEST_SUITES = { | 201 PYTHON_UNIT_TEST_SUITES = { |
| 213 'pylib_py_unittests': { | 202 'pylib_py_unittests': { |
| 214 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android'), | 203 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android'), |
| 215 'test_modules': [ | 204 'test_modules': [ |
| 216 'pylib.cmd_helper_test', | 205 'devil.android.device_utils_test', |
| 217 'pylib.device.device_utils_test', | 206 'devil.utils.cmd_helper_test', |
| 207 'devil.utils.md5sum_test', |
| 218 'pylib.results.json_results_test', | 208 'pylib.results.json_results_test', |
| 219 'pylib.utils.md5sum_test', | |
| 220 ] | 209 ] |
| 221 }, | 210 }, |
| 222 'gyp_py_unittests': { | 211 'gyp_py_unittests': { |
| 223 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'gyp'), | 212 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'gyp'), |
| 224 'test_modules': [ | 213 'test_modules': [ |
| 225 'java_cpp_enum_tests', | 214 'java_cpp_enum_tests', |
| 226 ] | 215 ] |
| 227 }, | 216 }, |
| 228 } | 217 } |
| 229 | 218 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 293 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
| 305 return 'adb' | 294 return 'adb' |
| 306 except OSError: | 295 except OSError: |
| 307 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 296 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
| 308 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 297 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
| 309 | 298 |
| 310 # Exit codes | 299 # Exit codes |
| 311 ERROR_EXIT_CODE = 1 | 300 ERROR_EXIT_CODE = 1 |
| 312 INFRA_EXIT_CODE = 87 | 301 INFRA_EXIT_CODE = 87 |
| 313 WARNING_EXIT_CODE = 88 | 302 WARNING_EXIT_CODE = 88 |
| OLD | NEW |