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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 elif test_suite_basename == 'perf_tests': | 124 elif test_suite_basename == 'perf_tests': |
125 return [ | 125 return [ |
126 'base/test/data', | 126 'base/test/data', |
127 ] | 127 ] |
128 elif test_suite_basename == 'content_browsertests': | 128 elif test_suite_basename == 'content_browsertests': |
129 return [ | 129 return [ |
130 'content/test/data', | 130 'content/test/data', |
131 ] | 131 ] |
132 return [] | 132 return [] |
133 | 133 |
| 134 def _GetOptionalDataFilesForTestSuite(test_suite_basename): |
| 135 """Returns a list of data files/dirs that are pushed if present. |
| 136 |
| 137 Args: |
| 138 test_suite_basename: The test suite basename for which to return file paths. |
| 139 |
| 140 Returns: |
| 141 A list of test file and directory paths. |
| 142 """ |
| 143 if test_suite_basename == 'content_browsertests': |
| 144 # See http://crbug.com/105104 for why these are needed. |
| 145 return [ |
| 146 'third_party/WebKit/LayoutTests/fast/events', |
| 147 'third_party/WebKit/LayoutTests/fast/files', |
| 148 'third_party/WebKit/LayoutTests/fast/filesystem', |
| 149 'third_party/WebKit/LayoutTests/fast/js/resources', |
| 150 'third_party/WebKit/LayoutTests/fast/workers', |
| 151 'third_party/WebKit/LayoutTests/http/tests', |
| 152 'third_party/WebKit/LayoutTests/media', |
| 153 'third_party/WebKit/LayoutTests/storage/indexeddb', |
| 154 ] |
| 155 return [] |
| 156 |
134 | 157 |
135 def _TestSuiteRequiresMockTestServer(test_suite_basename): | 158 def _TestSuiteRequiresMockTestServer(test_suite_basename): |
136 """Returns True if the test suite requires mock test server.""" | 159 """Returns True if the test suite requires mock test server.""" |
137 tests_require_net_test_server = ['unit_tests', 'net_unittests', | 160 tests_require_net_test_server = ['unit_tests', 'net_unittests', |
138 'content_unittests', | 161 'content_unittests', |
139 'content_browsertests'] | 162 'content_browsertests'] |
140 return (test_suite_basename in | 163 return (test_suite_basename in |
141 tests_require_net_test_server) | 164 tests_require_net_test_server) |
142 | 165 |
143 | 166 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 """Strips and copies the required data files for the test suite.""" | 222 """Strips and copies the required data files for the test suite.""" |
200 self.test_package.StripAndCopyExecutable() | 223 self.test_package.StripAndCopyExecutable() |
201 self.test_package.PushDataAndPakFiles() | 224 self.test_package.PushDataAndPakFiles() |
202 self.tool.CopyFiles() | 225 self.tool.CopyFiles() |
203 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) | 226 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) |
204 if test_data: | 227 if test_data: |
205 # Make sure SD card is ready. | 228 # Make sure SD card is ready. |
206 self.adb.WaitForSdCardReady(20) | 229 self.adb.WaitForSdCardReady(20) |
207 for data in test_data: | 230 for data in test_data: |
208 self.CopyTestData([data], self.adb.GetExternalStorage()) | 231 self.CopyTestData([data], self.adb.GetExternalStorage()) |
| 232 optional_test_data = _GetOptionalDataFilesForTestSuite( |
| 233 self.test_package.test_suite_basename) |
| 234 if optional_test_data: |
| 235 self.adb.WaitForSdCardReady(20) |
| 236 for data in optional_test_data: |
| 237 if os.path.exists(data): |
| 238 self.CopyTestData([data], self.adb.GetExternalStorage()) |
209 if self.test_package.test_suite_basename == 'webkit_unit_tests': | 239 if self.test_package.test_suite_basename == 'webkit_unit_tests': |
210 self.PushWebKitUnitTestsData() | 240 self.PushWebKitUnitTestsData() |
211 | 241 |
212 def PushWebKitUnitTestsData(self): | 242 def PushWebKitUnitTestsData(self): |
213 """Pushes the webkit_unit_tests data files to the device. | 243 """Pushes the webkit_unit_tests data files to the device. |
214 | 244 |
215 The path of this directory is different when the suite is being run as | 245 The path of this directory is different when the suite is being run as |
216 part of a WebKit check-out. | 246 part of a WebKit check-out. |
217 """ | 247 """ |
218 webkit_src = os.path.join(constants.CHROME_DIR, 'third_party', 'WebKit') | 248 webkit_src = os.path.join(constants.CHROME_DIR, 'third_party', 'WebKit') |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 self.LaunchChromeTestServerSpawner() | 310 self.LaunchChromeTestServerSpawner() |
281 self.tool.SetupEnvironment() | 311 self.tool.SetupEnvironment() |
282 | 312 |
283 #override | 313 #override |
284 def TearDown(self): | 314 def TearDown(self): |
285 """Cleans up the test enviroment for the test suite.""" | 315 """Cleans up the test enviroment for the test suite.""" |
286 self.tool.CleanUpEnvironment() | 316 self.tool.CleanUpEnvironment() |
287 if self._cleanup_test_files: | 317 if self._cleanup_test_files: |
288 self.adb.RemovePushedFiles() | 318 self.adb.RemovePushedFiles() |
289 super(TestRunner, self).TearDown() | 319 super(TestRunner, self).TearDown() |
OLD | NEW |