| 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 logging | 5 import logging |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from pylib import android_commands | 8 from pylib import android_commands |
| 9 from pylib import constants | 9 from pylib import constants |
| 10 from pylib.android_commands import errors | 10 from pylib.android_commands import errors |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 Args: | 24 Args: |
| 25 test_suite_basename: The test suite basename (e.g. base_unittests). | 25 test_suite_basename: The test suite basename (e.g. base_unittests). |
| 26 | 26 |
| 27 Returns: | 27 Returns: |
| 28 A list of test file and directory paths. | 28 A list of test file and directory paths. |
| 29 """ | 29 """ |
| 30 # Ideally, we'd just push all test data. However, it has >100MB, and a lot | 30 # Ideally, we'd just push all test data. However, it has >100MB, and a lot |
| 31 # of the files are not relevant (some are used for browser_tests, others for | 31 # of the files are not relevant (some are used for browser_tests, others for |
| 32 # features not supported, etc..). | 32 # features not supported, etc..). |
| 33 if test_suite_basename == 'media_unittests': | 33 if test_suite_basename == 'modules_unittests': |
| 34 return [ | |
| 35 'media/test/data', | |
| 36 ] | |
| 37 elif test_suite_basename == 'net_unittests': | |
| 38 return [ | |
| 39 'chrome/test/data/animate1.gif', | |
| 40 'chrome/test/data/simple.html', | |
| 41 'net/data/cache_tests', | |
| 42 'net/data/filter_unittests', | |
| 43 'net/data/ftp', | |
| 44 'net/data/proxy_resolver_v8_tracing_unittest', | |
| 45 'net/data/proxy_resolver_v8_unittest', | |
| 46 'net/data/proxy_script_fetcher_unittest', | |
| 47 'net/data/ssl/certificates', | |
| 48 'net/data/test.html', | |
| 49 'net/data/url_request_unittest/', | |
| 50 ] | |
| 51 elif test_suite_basename == 'ui_unittests': | |
| 52 return [ | |
| 53 'ui/base/test/data/data_pack_unittest/truncated-header.pak', | |
| 54 ] | |
| 55 elif test_suite_basename == 'content_unittests': | |
| 56 return [ | |
| 57 'content/test/data/gpu/webgl_conformance_test_expectations.txt', | |
| 58 'content/test/data/page_state/', | |
| 59 'net/data/ssl/certificates/', | |
| 60 'third_party/hyphen/hyph_en_US.dic', | |
| 61 'webkit/data/dom_storage/webcore_test_database.localstorage', | |
| 62 ] | |
| 63 elif test_suite_basename == 'cc_perftests': | |
| 64 return [ | |
| 65 'cc/test/data', | |
| 66 ] | |
| 67 elif test_suite_basename == 'content_browsertests': | |
| 68 return [ | |
| 69 'content/test/data/content-disposition-inline.html', | |
| 70 'content/test/data/title1.html', | |
| 71 'content/test/data/post_message2.html', | |
| 72 'content/test/data/content-sniffer-test0.html.mock-http-headers', | |
| 73 'content/test/data/content-sniffer-test1.html.mock-http-headers', | |
| 74 'content/test/data/speech', | |
| 75 'content/test/data/page404.html.mock-http-headers', | |
| 76 'content/test/data/content-sniffer-test3.html', | |
| 77 'content/test/data/post_message.html', | |
| 78 'content/test/data/remove_frame_on_unload.html', | |
| 79 'content/test/data/cross-origin-redirect-blocked.html', | |
| 80 'content/test/data/prerender', | |
| 81 'content/test/data/device_orientation', | |
| 82 'content/test/data/content-disposition-empty.html', | |
| 83 'content/test/data/workers', | |
| 84 'content/test/data/content-sniffer-test3.html.mock-http-headers', | |
| 85 'content/test/data/content-sniffer-test0.html', | |
| 86 'content/test/data/browser_plugin_title_change.html', | |
| 87 'content/test/data/android', | |
| 88 'content/test/data/page404.html', | |
| 89 'content/test/data/dynamic2.html', | |
| 90 'content/test/data/browser_plugin_embedder.html', | |
| 91 'content/test/data/indexeddb', | |
| 92 'content/test/data/content-disposition-inline.html.mock-http-headers', | |
| 93 'content/test/data/nosniff-test.html', | |
| 94 'content/test/data/title3.html', | |
| 95 'content/test/data/browser_plugin_post_message_guest.html', | |
| 96 'content/test/data/content-disposition-empty.html.mock-http-headers', | |
| 97 'content/test/data/session_history', | |
| 98 'content/test/data/browser_plugin_embedder.html', | |
| 99 'content/test/data/overscroll_navigation.html', | |
| 100 'content/test/data/simple_database.html', | |
| 101 'content/test/data/gtk_key_bindings_test_gtkrc', | |
| 102 'content/test/data/browser_plugin_embedder_guest_unresponsive.html', | |
| 103 'content/test/data/sync_xmlhttprequest.html', | |
| 104 'content/test/data/content-sniffer-test3-frame.txt.mock-http-headers', | |
| 105 'content/test/data/frame_tree', | |
| 106 'content/test/data/content-sniffer-test2.html.mock-http-headers', | |
| 107 'content/test/data/sync_xmlhttprequest_disallowed.html', | |
| 108 'content/test/data/rwh_simple.html', | |
| 109 'content/test/data/title2.html', | |
| 110 'content/test/data/webkit', | |
| 111 'content/test/data/content-sniffer-test1.html', | |
| 112 'content/test/data/download', | |
| 113 'content/test/data/content-sniffer-test2.html', | |
| 114 'content/test/data/simple_page.html', | |
| 115 'content/test/data/google.mht', | |
| 116 'content/test/data/site_per_process_main.html', | |
| 117 'content/test/data/gpu', | |
| 118 'content/test/data/onunload_cookie.html', | |
| 119 'content/test/data/textinput', | |
| 120 'content/test/data/navigate_opener.html', | |
| 121 'content/test/data/dom_storage', | |
| 122 'content/test/data/sync_xmlhttprequest_during_unload.html', | |
| 123 'content/test/data/browser_plugin_dragging.html', | |
| 124 'content/test/data/fileapi', | |
| 125 'content/test/data/npapi', | |
| 126 'content/test/data/nosniff-test.html.mock-http-headers', | |
| 127 'content/test/data/accessibility', | |
| 128 'content/test/data/dynamic1.html', | |
| 129 'content/test/data/browser_plugin_focus_child.html', | |
| 130 'content/test/data/rwhv_compositing_animation.html', | |
| 131 'content/test/data/click-noreferrer-links.html', | |
| 132 'content/test/data/browser_plugin_focus.html', | |
| 133 'content/test/data/media', | |
| 134 'third_party/webgl_conformance', | |
| 135 ] | |
| 136 elif test_suite_basename == 'modules_unittests': | |
| 137 return [ | 34 return [ |
| 138 'resources', | 35 'resources', |
| 139 'data', | 36 'data', |
| 140 ] | 37 ] |
| 141 return [] | 38 return [] |
| 142 | 39 |
| 143 | 40 |
| 144 def _TestSuiteRequiresMockTestServer(test_suite_basename): | 41 def _TestSuiteRequiresMockTestServer(test_suite_basename): |
| 145 """Returns True if the test suite requires mock test server.""" | 42 """Returns True if the test suite requires mock test server.""" |
| 146 tests_require_net_test_server = ['unit_tests', 'net_unittests', | 43 tests_require_net_test_server = ['unit_tests', 'net_unittests', |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 self.tool, | 103 self.tool, |
| 207 symbols_dir) | 104 symbols_dir) |
| 208 | 105 |
| 209 #override | 106 #override |
| 210 def InstallTestPackage(self): | 107 def InstallTestPackage(self): |
| 211 self.test_package.StripAndCopyExecutable() | 108 self.test_package.StripAndCopyExecutable() |
| 212 | 109 |
| 213 #override | 110 #override |
| 214 def PushDataDeps(self): | 111 def PushDataDeps(self): |
| 215 self.adb.WaitForSdCardReady(20) | 112 self.adb.WaitForSdCardReady(20) |
| 216 self.test_package.PushDataAndPakFiles() | |
| 217 self.tool.CopyFiles() | 113 self.tool.CopyFiles() |
| 218 if self.test_package.test_suite_basename == 'webkit_unit_tests': | 114 if self.test_package.test_suite_basename == 'webkit_unit_tests': |
| 219 self.PushWebKitUnitTestsData() | 115 self.PushWebKitUnitTestsData() |
| 220 return | 116 return |
| 221 | 117 |
| 222 if not self._deps_dir: | 118 if not self._deps_dir: |
| 223 logging.info('Did not find an isolate file for the test suite.') | 119 logging.info('Did not find an isolate file for the test suite.') |
| 224 for p in _GetDataFilesForTestSuite(self.test_package.test_suite_basename): | 120 for p in _GetDataFilesForTestSuite(self.test_package.test_suite_basename): |
| 225 self.adb.PushIfNeeded( | 121 self.adb.PushIfNeeded( |
| 226 os.path.join(constants.DIR_SOURCE_ROOT, p), | 122 os.path.join(constants.DIR_SOURCE_ROOT, p), |
| 227 os.path.join(self.adb.GetExternalStorage(), p)) | 123 os.path.join(self.adb.GetExternalStorage(), p)) |
| 228 return | 124 return |
| 229 | 125 |
| 126 device_dir = self.adb.GetExternalStorage() |
| 127 # TODO(frankf): linux_dumper_unittest_helper needs to be in the same dir |
| 128 # as breakpad_unittests exe. Find a better way to do this. |
| 129 if self.test_package.test_suite_basename == 'breakpad_unittests': |
| 130 device_dir = constants.TEST_EXECUTABLE_DIR |
| 230 for p in os.listdir(self._deps_dir): | 131 for p in os.listdir(self._deps_dir): |
| 231 self.adb.PushIfNeeded( | 132 self.adb.PushIfNeeded( |
| 232 os.path.join(self._deps_dir, p), | 133 os.path.join(self._deps_dir, p), |
| 233 os.path.join(self.adb.GetExternalStorage(), p)) | 134 os.path.join(device_dir, p)) |
| 234 | 135 |
| 235 def PushWebKitUnitTestsData(self): | 136 def PushWebKitUnitTestsData(self): |
| 236 """Pushes the webkit_unit_tests data files to the device. | 137 """Pushes the webkit_unit_tests data files to the device. |
| 237 | 138 |
| 238 The path of this directory is different when the suite is being run as | 139 The path of this directory is different when the suite is being run as |
| 239 part of a WebKit check-out. | 140 part of a WebKit check-out. |
| 240 """ | 141 """ |
| 241 webkit_src = os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', | 142 webkit_src = os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', |
| 242 'WebKit') | 143 'WebKit') |
| 243 if self.in_webkit_checkout: | 144 if self.in_webkit_checkout: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 self.LaunchChromeTestServerSpawner() | 204 self.LaunchChromeTestServerSpawner() |
| 304 self.tool.SetupEnvironment() | 205 self.tool.SetupEnvironment() |
| 305 | 206 |
| 306 #override | 207 #override |
| 307 def TearDown(self): | 208 def TearDown(self): |
| 308 """Cleans up the test enviroment for the test suite.""" | 209 """Cleans up the test enviroment for the test suite.""" |
| 309 self.tool.CleanUpEnvironment() | 210 self.tool.CleanUpEnvironment() |
| 310 if self._cleanup_test_files: | 211 if self._cleanup_test_files: |
| 311 self.adb.RemovePushedFiles() | 212 self.adb.RemovePushedFiles() |
| 312 super(TestRunner, self).TearDown() | 213 super(TestRunner, self).TearDown() |
| OLD | NEW |