Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 'chrome/test/data/json2.js', | 106 'chrome/test/data/json2.js', |
| 107 'chrome/test/data/sunspider', | 107 'chrome/test/data/sunspider', |
| 108 ] | 108 ] |
| 109 elif test_suite_basename == 'content_unittests': | 109 elif test_suite_basename == 'content_unittests': |
| 110 return [ | 110 return [ |
| 111 'content/test/data/gpu/webgl_conformance_test_expectations.txt', | 111 'content/test/data/gpu/webgl_conformance_test_expectations.txt', |
| 112 'net/data/ssl/certificates/', | 112 'net/data/ssl/certificates/', |
| 113 'webkit/data/dom_storage/webcore_test_database.localstorage', | 113 'webkit/data/dom_storage/webcore_test_database.localstorage', |
| 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': | |
| 117 return [ | |
| 118 'media/test/data', | |
| 119 ] | |
| 120 elif test_suite_basename == 'cc_perftests': | 116 elif test_suite_basename == 'cc_perftests': |
| 121 return [ | 117 return [ |
| 122 'cc/test/data', | 118 'cc/test/data', |
| 123 ] | 119 ] |
| 124 elif test_suite_basename == 'perf_tests': | 120 elif test_suite_basename == 'perf_tests': |
| 125 return [ | 121 return [ |
| 126 'base/test/data', | 122 'base/test/data', |
| 127 ] | 123 ] |
| 128 elif test_suite_basename == 'content_browsertests': | 124 elif test_suite_basename == 'content_browsertests': |
| 129 return [ | 125 return [ |
| 130 'content/test/data', | 126 'content/test/data/content-disposition-inline.html', |
| 127 'content/test/data/title1.html', | |
| 128 'content/test/data/post_message2.html', | |
| 129 'content/test/data/content-sniffer-test0.html.mock-http-headers', | |
| 130 'content/test/data/content-sniffer-test1.html.mock-http-headers', | |
| 131 'content/test/data/speech', | |
| 132 'content/test/data/page404.html.mock-http-headers', | |
| 133 'content/test/data/content-sniffer-test3.html', | |
| 134 'content/test/data/post_message.html', | |
| 135 'content/test/data/remove_frame_on_unload.html', | |
| 136 'content/test/data/cross-origin-redirect-blocked.html', | |
| 137 'content/test/data/prerender', | |
| 138 'content/test/data/device_orientation', | |
| 139 'content/test/data/content-disposition-empty.html', | |
| 140 'content/test/data/workers', | |
| 141 'content/test/data/content-sniffer-test3.html.mock-http-headers', | |
| 142 'content/test/data/content-sniffer-test0.html', | |
| 143 'content/test/data/browser_plugin_title_change.html', | |
| 144 'content/test/data/android', | |
| 145 'content/test/data/page404.html', | |
| 146 'content/test/data/dynamic2.html', | |
| 147 'content/test/data/browser_plugin_embedder.html', | |
| 148 'content/test/data/indexeddb', | |
| 149 'content/test/data/content-disposition-inline.html.mock-http-headers', | |
| 150 'content/test/data/nosniff-test.html', | |
| 151 'content/test/data/title3.html', | |
| 152 'content/test/data/browser_plugin_post_message_guest.html', | |
| 153 'content/test/data/content-disposition-empty.html.mock-http-headers', | |
| 154 'content/test/data/session_history', | |
| 155 'content/test/data/browser_plugin_naming_guest.html', | |
| 156 'content/test/data/overscroll_navigation.html', | |
| 157 'content/test/data/simple_database.html', | |
| 158 'content/test/data/gtk_key_bindings_test_gtkrc', | |
| 159 'content/test/data/browser_plugin_embedder_guest_unresponsive.html', | |
| 160 'content/test/data/sync_xmlhttprequest.html', | |
| 161 'content/test/data/content-sniffer-test3-frame.txt.mock-http-headers', | |
| 162 'content/test/data/frame_tree', | |
| 163 'content/test/data/browser_plugin_naming_embedder.html', | |
| 164 'content/test/data/content-sniffer-test2.html.mock-http-headers', | |
| 165 'content/test/data/sync_xmlhttprequest_disallowed.html', | |
| 166 'content/test/data/rwh_simple.html', | |
| 167 'content/test/data/title2.html', | |
| 168 'content/test/data/webkit', | |
| 169 'content/test/data/content-sniffer-test1.html', | |
| 170 'content/test/data/download', | |
| 171 'content/test/data/rwhv_compositing_static.html', | |
| 172 'content/test/data/content-sniffer-test2.html', | |
| 173 'content/test/data/simple_page.html', | |
| 174 'content/test/data/google.mht', | |
| 175 'content/test/data/site_per_process_main.html', | |
| 176 'content/test/data/gpu', | |
| 177 'content/test/data/onunload_cookie.html', | |
| 178 'content/test/data/textinput', | |
| 179 'content/test/data/navigate_opener.html', | |
| 180 'content/test/data/dom_storage', | |
| 181 'content/test/data/sync_xmlhttprequest_during_unload.html', | |
| 182 'content/test/data/browser_plugin_dragging.html', | |
| 183 'content/test/data/content-sniffer-test3-frame.txt', | |
| 184 'content/test/data/fileapi', | |
| 185 'content/test/data/npapi', | |
| 186 'content/test/data/nosniff-test.html.mock-http-headers', | |
| 187 'content/test/data/accessibility', | |
| 188 'content/test/data/dynamic1.html', | |
| 189 'content/test/data/browser_plugin_focus_child.html', | |
| 190 'content/test/data/rwhv_compositing_animation.html', | |
| 191 'content/test/data/click-noreferrer-links.html', | |
| 192 'content/test/data/browser_plugin_focus.html', | |
| 131 ] | 193 ] |
| 132 return [] | 194 return [] |
| 133 | 195 |
| 196 | |
| 134 def _GetOptionalDataFilesForTestSuite(test_suite_basename): | 197 def _GetOptionalDataFilesForTestSuite(test_suite_basename): |
| 135 """Returns a list of data files/dirs that are pushed if present. | 198 """Returns a list of data files/dirs that are pushed if present. |
| 136 | 199 |
| 137 Args: | 200 Args: |
| 138 test_suite_basename: The test suite basename for which to return file paths. | 201 test_suite_basename: The test suite basename for which to return file paths. |
| 139 | 202 |
| 140 Returns: | 203 Returns: |
| 141 A list of test file and directory paths. | 204 A list of test file and directory paths. |
| 142 """ | 205 """ |
| 143 if test_suite_basename == 'content_browsertests': | 206 if test_suite_basename == 'content_browsertests': |
| 144 # See http://crbug.com/105104 for why these are needed. | 207 # See http://crbug.com/105104 for why these are needed. |
| 145 return [ | 208 return [ |
| 146 'third_party/WebKit/LayoutTests/fast/events', | 209 'third_party/WebKit/LayoutTests/fast/events', |
| 147 'third_party/WebKit/LayoutTests/fast/files', | 210 'third_party/WebKit/LayoutTests/fast/files', |
| 148 'third_party/WebKit/LayoutTests/fast/filesystem', | 211 'third_party/WebKit/LayoutTests/fast/filesystem', |
| 149 'third_party/WebKit/LayoutTests/fast/js/resources', | 212 'third_party/WebKit/LayoutTests/fast/js/resources', |
| 150 'third_party/WebKit/LayoutTests/fast/workers', | 213 'third_party/WebKit/LayoutTests/fast/workers', |
| 151 'third_party/WebKit/LayoutTests/http/tests', | 214 'third_party/WebKit/LayoutTests/http/tests', |
| 152 'third_party/WebKit/LayoutTests/media', | 215 'third_party/WebKit/LayoutTests/storage/indexeddb', |
| 153 'third_party/WebKit/LayoutTests/storage/indexeddb', | 216 'content/test/data/layout_tests/LayoutTests/fast/events', |
| 217 'content/test/data/layout_tests/LayoutTests/fast/files', | |
| 218 'content/test/data/layout_tests/LayoutTests/fast/filesystem', | |
| 219 'content/test/data/layout_tests/LayoutTests/fast/js/resources', | |
| 220 'content/test/data/layout_tests/LayoutTests/fast/workers', | |
| 221 'content/test/data/layout_tests/LayoutTests/http/tests', | |
| 222 'content/test/data/layout_tests/LayoutTests/storage/indexeddb', | |
| 154 ] | 223 ] |
| 155 return [] | 224 return [] |
| 156 | 225 |
| 157 | 226 |
| 158 def _TestSuiteRequiresMockTestServer(test_suite_basename): | 227 def _TestSuiteRequiresMockTestServer(test_suite_basename): |
| 159 """Returns True if the test suite requires mock test server.""" | 228 """Returns True if the test suite requires mock test server.""" |
| 160 tests_require_net_test_server = ['unit_tests', 'net_unittests', | 229 tests_require_net_test_server = ['unit_tests', 'net_unittests', |
| 161 'content_unittests', | 230 'content_unittests', |
| 162 'content_browsertests'] | 231 'content_browsertests'] |
| 163 return (test_suite_basename in | 232 return (test_suite_basename in |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 self.tool.CopyFiles() | 293 self.tool.CopyFiles() |
| 225 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) | 294 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) |
| 226 if test_data: | 295 if test_data: |
| 227 # Make sure SD card is ready. | 296 # Make sure SD card is ready. |
| 228 self.adb.WaitForSdCardReady(20) | 297 self.adb.WaitForSdCardReady(20) |
| 229 for data in test_data: | 298 for data in test_data: |
| 230 self.CopyTestData([data], self.adb.GetExternalStorage()) | 299 self.CopyTestData([data], self.adb.GetExternalStorage()) |
| 231 optional_test_data = _GetOptionalDataFilesForTestSuite( | 300 optional_test_data = _GetOptionalDataFilesForTestSuite( |
| 232 self.test_package.test_suite_basename) | 301 self.test_package.test_suite_basename) |
| 233 if optional_test_data: | 302 if optional_test_data: |
| 234 self.adb.WaitForSdCardReady(20) | 303 self.adb.WaitForSdCardReady(20) |
|
frankf
2013/04/05 22:14:14
Why do we need to check for sdcard again here?
nilesh
2013/04/05 22:16:19
if a test only has optional data and no test_data.
frankf
2013/04/05 22:19:48
Not really (it's just a 'adb shell ls /sdcard'), b
| |
| 235 for data in optional_test_data: | 304 for data in optional_test_data: |
| 236 if os.path.exists(data): | 305 if os.path.exists(data): |
| 237 self.CopyTestData([data], self.adb.GetExternalStorage()) | 306 self.CopyTestData([data], self.adb.GetExternalStorage()) |
| 238 if self.test_package.test_suite_basename == 'webkit_unit_tests': | 307 if self.test_package.test_suite_basename == 'webkit_unit_tests': |
| 239 self.PushWebKitUnitTestsData() | 308 self.PushWebKitUnitTestsData() |
| 240 | 309 |
| 241 def PushWebKitUnitTestsData(self): | 310 def PushWebKitUnitTestsData(self): |
| 242 """Pushes the webkit_unit_tests data files to the device. | 311 """Pushes the webkit_unit_tests data files to the device. |
| 243 | 312 |
| 244 The path of this directory is different when the suite is being run as | 313 The path of this directory is different when the suite is being run as |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 self.LaunchChromeTestServerSpawner() | 377 self.LaunchChromeTestServerSpawner() |
| 309 self.tool.SetupEnvironment() | 378 self.tool.SetupEnvironment() |
| 310 | 379 |
| 311 #override | 380 #override |
| 312 def TearDown(self): | 381 def TearDown(self): |
| 313 """Cleans up the test enviroment for the test suite.""" | 382 """Cleans up the test enviroment for the test suite.""" |
| 314 self.tool.CleanUpEnvironment() | 383 self.tool.CleanUpEnvironment() |
| 315 if self._cleanup_test_files: | 384 if self._cleanup_test_files: |
| 316 self.adb.RemovePushedFiles() | 385 self.adb.RemovePushedFiles() |
| 317 super(TestRunner, self).TearDown() | 386 super(TestRunner, self).TearDown() |
| OLD | NEW |