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 import glob | 5 import glob |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from pylib import android_commands | 9 from pylib import android_commands |
10 from pylib import constants | 10 from pylib import constants |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 'third_party/hyphen/hyph_en_US.dic', | 114 'third_party/hyphen/hyph_en_US.dic', |
115 ] | 115 ] |
116 elif test_suite_basename == 'media_unittests': | 116 elif test_suite_basename == 'media_unittests': |
117 return [ | 117 return [ |
118 'media/test/data', | 118 'media/test/data', |
119 ] | 119 ] |
120 elif test_suite_basename == 'cc_perftests': | 120 elif test_suite_basename == 'cc_perftests': |
121 return [ | 121 return [ |
122 'cc/test/data', | 122 'cc/test/data', |
123 ] | 123 ] |
124 elif test_suite_basename == 'content_browsertests': | |
125 return [ | |
126 'content/test/data', | |
127 ] | |
124 return [] | 128 return [] |
125 | 129 |
126 | 130 |
127 def _TestSuiteRequiresMockTestServer(test_suite_basename): | 131 def _TestSuiteRequiresMockTestServer(test_suite_basename): |
128 """Returns True if the test suite requires mock test server.""" | 132 """Returns True if the test suite requires mock test server.""" |
129 tests_require_net_test_server = ['unit_tests', 'net_unittests', | 133 tests_require_net_test_server = ['unit_tests', 'net_unittests', |
130 'content_unittests'] | 134 'content_unittests', |
135 'content_browsertests'] | |
131 return (test_suite_basename in | 136 return (test_suite_basename in |
132 tests_require_net_test_server) | 137 tests_require_net_test_server) |
133 | 138 |
134 | 139 |
135 class TestRunner(base_test_runner.BaseTestRunner): | 140 class TestRunner(base_test_runner.BaseTestRunner): |
136 """Single test suite attached to a single device. | 141 """Single test suite attached to a single device. |
137 | 142 |
138 Args: | 143 Args: |
139 device: Device to run the tests. | 144 device: Device to run the tests. |
140 test_suite: A specific test suite to run, empty to run all. | 145 test_suite: A specific test suite to run, empty to run all. |
141 test_arguments: Additional arguments to pass to the test binary. | 146 test_arguments: Additional arguments to pass to the test binary. |
142 timeout: Timeout for each test. | 147 timeout: Timeout for each test. |
143 cleanup_test_files: Whether or not to cleanup test files on device. | 148 cleanup_test_files: Whether or not to cleanup test files on device. |
144 tool_name: Name of the Valgrind tool. | 149 tool_name: Name of the Valgrind tool. |
145 build_type: 'Release' or 'Debug'. | 150 build_type: 'Release' or 'Debug'. |
146 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. | 151 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. |
152 test_apk_package_name: Apk package name for tests running in APKs. | |
153 test_activity_name: Test activity to invoke for APK tests. | |
154 command_line_file: Filename to use to pass arguments to tests. | |
147 """ | 155 """ |
148 | 156 |
149 def __init__(self, device, test_suite, test_arguments, timeout, | 157 def __init__(self, device, test_suite, test_arguments, timeout, |
150 cleanup_test_files, tool_name, build_type, | 158 cleanup_test_files, tool_name, build_type, |
151 in_webkit_checkout): | 159 in_webkit_checkout, test_apk_package_name, test_activity_name, |
160 command_line_file): | |
frankf
2013/02/21 19:25:50
These paramters are not required for test_package_
nilesh
2013/02/21 20:10:17
Done.
| |
152 super(TestRunner, self).__init__(device, tool_name, build_type) | 161 super(TestRunner, self).__init__(device, tool_name, build_type) |
153 self._running_on_emulator = self.device.startswith('emulator') | 162 self._running_on_emulator = self.device.startswith('emulator') |
154 self._test_arguments = test_arguments | 163 self._test_arguments = test_arguments |
155 self.in_webkit_checkout = in_webkit_checkout | 164 self.in_webkit_checkout = in_webkit_checkout |
156 self._cleanup_test_files = cleanup_test_files | 165 self._cleanup_test_files = cleanup_test_files |
157 | 166 |
158 logging.warning('Test suite: ' + test_suite) | 167 logging.warning('Test suite: ' + test_suite) |
159 if os.path.splitext(test_suite)[1] == '.apk': | 168 if os.path.splitext(test_suite)[1] == '.apk': |
160 self.test_package = test_package_apk.TestPackageApk( | 169 self.test_package = test_package_apk.TestPackageApk( |
161 self.adb, | 170 self.adb, |
162 device, | 171 device, |
163 test_suite, | 172 test_suite, |
164 timeout, | 173 timeout, |
165 self._cleanup_test_files, | 174 self._cleanup_test_files, |
166 self.tool) | 175 self.tool, |
176 test_apk_package_name, | |
177 test_activity_name, | |
178 command_line_file) | |
167 else: | 179 else: |
168 # Put a copy into the android out/target directory, to allow stack trace | 180 # Put a copy into the android out/target directory, to allow stack trace |
169 # generation. | 181 # generation. |
170 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, | 182 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, |
171 'lib.target') | 183 'lib.target') |
172 self.test_package = test_package_executable.TestPackageExecutable( | 184 self.test_package = test_package_executable.TestPackageExecutable( |
173 self.adb, | 185 self.adb, |
174 device, | 186 device, |
175 test_suite, | 187 test_suite, |
176 timeout, | 188 timeout, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): | 280 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): |
269 self.LaunchChromeTestServerSpawner() | 281 self.LaunchChromeTestServerSpawner() |
270 self.tool.SetupEnvironment() | 282 self.tool.SetupEnvironment() |
271 | 283 |
272 def TearDown(self): | 284 def TearDown(self): |
273 """Cleans up the test enviroment for the test suite.""" | 285 """Cleans up the test enviroment for the test suite.""" |
274 self.tool.CleanUpEnvironment() | 286 self.tool.CleanUpEnvironment() |
275 if self._cleanup_test_files: | 287 if self._cleanup_test_files: |
276 self.adb.RemovePushedFiles() | 288 self.adb.RemovePushedFiles() |
277 super(TestRunner, self).TearDown() | 289 super(TestRunner, self).TearDown() |
OLD | NEW |