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 glob | 12 import glob |
13 import logging | 13 import logging |
14 import os | 14 import os |
15 import subprocess | 15 import subprocess |
16 | 16 |
17 import devil.android.sdk.keyevent | 17 import devil.android.sdk.keyevent |
18 from devil.android.sdk import version_codes | 18 from devil.android.sdk import version_codes |
19 from devil.constants import exit_codes | 19 from devil.constants import exit_codes |
20 | 20 |
21 | 21 |
22 keyevent = devil.android.sdk.keyevent | 22 keyevent = devil.android.sdk.keyevent |
23 | 23 |
24 | 24 |
25 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', | 25 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', |
26 os.path.abspath(os.path.join(os.path.dirname(__file__), | 26 os.path.abspath(os.path.join(os.path.dirname(__file__), |
27 os.pardir, os.pardir, os.pardir, os.pardir))) | 27 os.pardir, os.pardir, os.pardir, os.pardir))) |
28 | 28 |
29 PackageInfo = collections.namedtuple('PackageInfo', | 29 PackageInfo = collections.namedtuple('PackageInfo', |
30 ['package', 'activity', 'cmdline_file', 'devtools_socket', | 30 ['package', 'activity', 'cmdline_file', 'devtools_socket']) |
31 'test_package']) | |
32 | 31 |
33 PACKAGE_INFO = { | 32 PACKAGE_INFO = { |
34 'chrome_document': PackageInfo( | 33 'chrome_document': PackageInfo( |
35 'com.google.android.apps.chrome.document', | 34 'com.google.android.apps.chrome.document', |
36 'com.google.android.apps.chrome.document.ChromeLauncherActivity', | 35 'com.google.android.apps.chrome.document.ChromeLauncherActivity', |
37 '/data/local/chrome-command-line', | 36 '/data/local/chrome-command-line', |
38 'chrome_devtools_remote', | 37 'chrome_devtools_remote'), |
39 None), | |
40 'chrome': PackageInfo( | 38 'chrome': PackageInfo( |
41 'com.google.android.apps.chrome', | 39 'com.google.android.apps.chrome', |
42 'com.google.android.apps.chrome.Main', | 40 'com.google.android.apps.chrome.Main', |
43 '/data/local/chrome-command-line', | 41 '/data/local/chrome-command-line', |
44 'chrome_devtools_remote', | 42 'chrome_devtools_remote'), |
45 'com.google.android.apps.chrome.tests'), | |
46 'chrome_beta': PackageInfo( | 43 'chrome_beta': PackageInfo( |
47 'com.chrome.beta', | 44 'com.chrome.beta', |
48 'com.google.android.apps.chrome.Main', | 45 'com.google.android.apps.chrome.Main', |
49 '/data/local/chrome-command-line', | 46 '/data/local/chrome-command-line', |
50 'chrome_devtools_remote', | 47 'chrome_devtools_remote'), |
51 None), | |
52 'chrome_stable': PackageInfo( | 48 'chrome_stable': PackageInfo( |
53 'com.android.chrome', | 49 'com.android.chrome', |
54 'com.google.android.apps.chrome.Main', | 50 'com.google.android.apps.chrome.Main', |
55 '/data/local/chrome-command-line', | 51 '/data/local/chrome-command-line', |
56 'chrome_devtools_remote', | 52 'chrome_devtools_remote'), |
57 None), | |
58 'chrome_dev': PackageInfo( | 53 'chrome_dev': PackageInfo( |
59 'com.chrome.dev', | 54 'com.chrome.dev', |
60 'com.google.android.apps.chrome.Main', | 55 'com.google.android.apps.chrome.Main', |
61 '/data/local/chrome-command-line', | 56 '/data/local/chrome-command-line', |
62 'chrome_devtools_remote', | 57 'chrome_devtools_remote'), |
63 None), | |
64 'chrome_canary': PackageInfo( | 58 'chrome_canary': PackageInfo( |
65 'com.chrome.canary', | 59 'com.chrome.canary', |
66 'com.google.android.apps.chrome.Main', | 60 'com.google.android.apps.chrome.Main', |
67 '/data/local/chrome-command-line', | 61 '/data/local/chrome-command-line', |
68 'chrome_devtools_remote', | 62 'chrome_devtools_remote'), |
69 None), | |
70 'chrome_work': PackageInfo( | 63 'chrome_work': PackageInfo( |
71 'com.chrome.work', | 64 'com.chrome.work', |
72 'com.google.android.apps.chrome.Main', | 65 'com.google.android.apps.chrome.Main', |
73 '/data/local/chrome-command-line', | 66 '/data/local/chrome-command-line', |
74 'chrome_devtools_remote', | 67 'chrome_devtools_remote'), |
75 None), | |
76 'chromium': PackageInfo( | 68 'chromium': PackageInfo( |
77 'org.chromium.chrome', | 69 'org.chromium.chrome', |
78 'com.google.android.apps.chrome.Main', | 70 'com.google.android.apps.chrome.Main', |
79 '/data/local/chrome-command-line', | 71 '/data/local/chrome-command-line', |
80 'chrome_devtools_remote', | 72 'chrome_devtools_remote'), |
81 'org.chromium.chrome.tests'), | |
82 'legacy_browser': PackageInfo( | 73 'legacy_browser': PackageInfo( |
83 'com.google.android.browser', | 74 'com.google.android.browser', |
84 'com.android.browser.BrowserActivity', | 75 'com.android.browser.BrowserActivity', |
85 None, | 76 None, |
86 None, | |
87 None), | 77 None), |
88 'chromecast_shell': PackageInfo( | 78 'chromecast_shell': PackageInfo( |
89 'com.google.android.apps.mediashell', | 79 'com.google.android.apps.mediashell', |
90 'com.google.android.apps.mediashell.MediaShellActivity', | 80 'com.google.android.apps.mediashell.MediaShellActivity', |
91 '/data/local/tmp/castshell-command-line', | 81 '/data/local/tmp/castshell-command-line', |
92 None, | |
93 None), | 82 None), |
94 'content_shell': PackageInfo( | 83 'content_shell': PackageInfo( |
95 'org.chromium.content_shell_apk', | 84 'org.chromium.content_shell_apk', |
96 'org.chromium.content_shell_apk.ContentShellActivity', | 85 'org.chromium.content_shell_apk.ContentShellActivity', |
97 '/data/local/tmp/content-shell-command-line', | 86 '/data/local/tmp/content-shell-command-line', |
98 None, | 87 None), |
99 'org.chromium.content_shell_apk.tests'), | |
100 'android_webview_shell': PackageInfo( | 88 'android_webview_shell': PackageInfo( |
101 'org.chromium.android_webview.shell', | 89 'org.chromium.android_webview.shell', |
102 'org.chromium.android_webview.shell.AwShellActivity', | 90 'org.chromium.android_webview.shell.AwShellActivity', |
103 '/data/local/tmp/android-webview-command-line', | 91 '/data/local/tmp/android-webview-command-line', |
104 None, | 92 None), |
105 'org.chromium.android_webview.test'), | |
106 'gtest': PackageInfo( | 93 'gtest': PackageInfo( |
107 'org.chromium.native_test', | 94 'org.chromium.native_test', |
108 'org.chromium.native_test.NativeUnitTestActivity', | 95 'org.chromium.native_test.NativeUnitTestActivity', |
109 '/data/local/tmp/chrome-native-tests-command-line', | 96 '/data/local/tmp/chrome-native-tests-command-line', |
110 None, | |
111 None), | 97 None), |
112 'components_browsertests': PackageInfo( | 98 'components_browsertests': PackageInfo( |
113 'org.chromium.components_browsertests_apk', | 99 'org.chromium.components_browsertests_apk', |
114 ('org.chromium.components_browsertests_apk' + | 100 ('org.chromium.components_browsertests_apk' + |
115 '.ComponentsBrowserTestsActivity'), | 101 '.ComponentsBrowserTestsActivity'), |
116 '/data/local/tmp/chrome-native-tests-command-line', | 102 '/data/local/tmp/chrome-native-tests-command-line', |
117 None, | |
118 None), | 103 None), |
119 'content_browsertests': PackageInfo( | 104 'content_browsertests': PackageInfo( |
120 'org.chromium.content_browsertests_apk', | 105 'org.chromium.content_browsertests_apk', |
121 'org.chromium.content_browsertests_apk.ContentBrowserTestsActivity', | 106 'org.chromium.content_browsertests_apk.ContentBrowserTestsActivity', |
122 '/data/local/tmp/chrome-native-tests-command-line', | 107 '/data/local/tmp/chrome-native-tests-command-line', |
123 None, | |
124 None), | 108 None), |
125 'chromedriver_webview_shell': PackageInfo( | 109 'chromedriver_webview_shell': PackageInfo( |
126 'org.chromium.chromedriver_webview_shell', | 110 'org.chromium.chromedriver_webview_shell', |
127 'org.chromium.chromedriver_webview_shell.Main', | 111 'org.chromium.chromedriver_webview_shell.Main', |
128 None, | 112 None, |
129 None, | |
130 None), | 113 None), |
131 } | 114 } |
132 | 115 |
133 | 116 |
134 # Ports arrangement for various test servers used in Chrome for Android. | 117 # Ports arrangement for various test servers used in Chrome for Android. |
135 # Lighttpd server will attempt to use 9000 as default port, if unavailable it | 118 # Lighttpd server will attempt to use 9000 as default port, if unavailable it |
136 # will find a free port from 8001 - 8999. | 119 # will find a free port from 8001 - 8999. |
137 LIGHTTPD_DEFAULT_PORT = 9000 | 120 LIGHTTPD_DEFAULT_PORT = 9000 |
138 LIGHTTPD_RANDOM_PORT_FIRST = 8001 | 121 LIGHTTPD_RANDOM_PORT_FIRST = 8001 |
139 LIGHTTPD_RANDOM_PORT_LAST = 8999 | 122 LIGHTTPD_RANDOM_PORT_LAST = 8999 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 # remove this. | 262 # remove this. |
280 def GetAdbPath(): | 263 def GetAdbPath(): |
281 from devil.android.sdk import adb_wrapper | 264 from devil.android.sdk import adb_wrapper |
282 return adb_wrapper.AdbWrapper.GetAdbPath() | 265 return adb_wrapper.AdbWrapper.GetAdbPath() |
283 | 266 |
284 | 267 |
285 # Exit codes | 268 # Exit codes |
286 ERROR_EXIT_CODE = exit_codes.ERROR | 269 ERROR_EXIT_CODE = exit_codes.ERROR |
287 INFRA_EXIT_CODE = exit_codes.INFRA | 270 INFRA_EXIT_CODE = exit_codes.INFRA |
288 WARNING_EXIT_CODE = exit_codes.WARNING | 271 WARNING_EXIT_CODE = exit_codes.WARNING |
OLD | NEW |