| 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" | 5 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" |
| 6 | 6 |
| 7 import fnmatch | 7 import fnmatch |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 self.tests_iter = (BaseTestSharder.tests_container) | 155 self.tests_iter = (BaseTestSharder.tests_container) |
| 156 assert self.tests_iter | 156 assert self.tests_iter |
| 157 return self.tests_iter | 157 return self.tests_iter |
| 158 | 158 |
| 159 def CopyTestFilesOnce(self): | 159 def CopyTestFilesOnce(self): |
| 160 """Pushes the test data files to the device. Installs the apk if opted.""" | 160 """Pushes the test data files to the device. Installs the apk if opted.""" |
| 161 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): | 161 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): |
| 162 logging.warning('Already copied test files to device %s, skipping.', | 162 logging.warning('Already copied test files to device %s, skipping.', |
| 163 self.device) | 163 self.device) |
| 164 return | 164 return |
| 165 host_test_files_path = (constants.CHROME_DIR + | 165 host_test_files = [ |
| 166 '/chrome/test/data/android/device_files') | 166 ('android_webview/test/data/device_files', 'webview'), |
| 167 if os.path.exists(host_test_files_path): | 167 ('content/test/data/android/device_files', 'content'), |
| 168 self.adb.PushIfNeeded(host_test_files_path, | 168 ('chrome/test/data/android/device_files', 'chrome') |
| 169 self.adb.GetExternalStorage() + '/' + | 169 ] |
| 170 TestRunner._DEVICE_DATA_DIR) | 170 for (host_src, dst_layer) in host_test_files: |
| 171 host_test_files_path = constants.CHROME_DIR + '/' + host_src |
| 172 if os.path.exists(host_test_files_path): |
| 173 self.adb.PushIfNeeded(host_test_files_path, |
| 174 self.adb.GetExternalStorage() + '/' + |
| 175 TestRunner._DEVICE_DATA_DIR + '/' + dst_layer) |
| 171 if self.install_apk: | 176 if self.install_apk: |
| 172 for apk in self.apks: | 177 for apk in self.apks: |
| 173 self.adb.ManagedInstall(apk.GetApkPath(), | 178 self.adb.ManagedInstall(apk.GetApkPath(), |
| 174 package_name=apk.GetPackageName()) | 179 package_name=apk.GetPackageName()) |
| 175 self.tool.CopyFiles() | 180 self.tool.CopyFiles() |
| 176 TestRunner._DEVICE_HAS_TEST_FILES[self.device] = True | 181 TestRunner._DEVICE_HAS_TEST_FILES[self.device] = True |
| 177 | 182 |
| 178 def SaveCoverageData(self, test): | 183 def SaveCoverageData(self, test): |
| 179 """Saves the Emma coverage data before it's overwritten by the next test. | 184 """Saves the Emma coverage data before it's overwritten by the next test. |
| 180 | 185 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 587 |
| 583 logging.info('Will run: %s', str(tests)) | 588 logging.info('Will run: %s', str(tests)) |
| 584 | 589 |
| 585 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): | 590 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): |
| 586 logging.warning('Coverage / debugger can not be sharded, ' | 591 logging.warning('Coverage / debugger can not be sharded, ' |
| 587 'using first available device') | 592 'using first available device') |
| 588 attached_devices = attached_devices[:1] | 593 attached_devices = attached_devices[:1] |
| 589 sharder = TestSharder(attached_devices, options, tests, apks) | 594 sharder = TestSharder(attached_devices, options, tests, apks) |
| 590 test_results = sharder.RunShardedTests() | 595 test_results = sharder.RunShardedTests() |
| 591 return test_results | 596 return test_results |
| OLD | NEW |