Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py

Issue 2110823002: Rename functions in Port related to wptserve and add a helper function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 # used by e.g. tools/valgrind/valgrind_tests.py. 221 # used by e.g. tools/valgrind/valgrind_tests.py.
222 return shlex.split(wrapper_option) if wrapper_option else [] 222 return shlex.split(wrapper_option) if wrapper_option else []
223 223
224 HTTP_DIR = "http/tests/" 224 HTTP_DIR = "http/tests/"
225 HTTP_LOCAL_DIR = "http/tests/local/" 225 HTTP_LOCAL_DIR = "http/tests/local/"
226 WPT_DIR = "imported/wpt/" 226 WPT_DIR = "imported/wpt/"
227 227
228 def is_http_test(self, test_name): 228 def is_http_test(self, test_name):
229 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith( self.HTTP_LOCAL_DIR) 229 return test_name.startswith(self.HTTP_DIR) and not test_name.startswith( self.HTTP_LOCAL_DIR)
230 230
231 def _should_treat_as_wpt_test(self, test_name):
232 return self._port.is_wpt_enabled() and self._port.is_wpt_test(test_name)
233
234 def _get_http_host_and_ports_for_test(self, test_name): 231 def _get_http_host_and_ports_for_test(self, test_name):
235 if self._should_treat_as_wpt_test(test_name): 232 if self._port.should_use_wptserve(test_name):
236 # TODO(burnik): Read from config or args. 233 # TODO(burnik): Read from config or args.
237 return ("web-platform.test", 8001, 8444) 234 return ("web-platform.test", 8001, 8444)
238 else: 235 else:
239 return ("127.0.0.1", 8000, 8443) 236 return ("127.0.0.1", 8000, 8443)
240 237
241 def test_to_uri(self, test_name): 238 def test_to_uri(self, test_name):
242 """Convert a test name to a URI. 239 """Convert a test name to a URI.
243 240
244 Tests which have an 'https' directory in their paths (e.g. 241 Tests which have an 'https' directory in their paths (e.g.
245 '/http/tests/security/mixedContent/https/test1.html') or '.https.' in 242 '/http/tests/security/mixedContent/https/test1.html') or '.https.' in
246 their name (e.g. 'http/tests/security/mixedContent/test1.https.html') wi ll 243 their name (e.g. 'http/tests/security/mixedContent/test1.https.html') wi ll
247 be loaded over HTTPS; all other tests over HTTP. 244 be loaded over HTTPS; all other tests over HTTP.
248 """ 245 """
249 is_wpt_test = self._should_treat_as_wpt_test(test_name) 246 using_wptserve = self._port.should_use_wptserve(test_name)
250 247
251 if not self.is_http_test(test_name) and not is_wpt_test: 248 if not self.is_http_test(test_name) and not using_wptserve:
252 return path.abspath_to_uri(self._port.host.platform, self._port.absp ath_for_test(test_name)) 249 return path.abspath_to_uri(self._port.host.platform, self._port.absp ath_for_test(test_name))
253 250
254 if is_wpt_test: 251 if using_wptserve:
255 test_dir_prefix = self.WPT_DIR 252 test_dir_prefix = self.WPT_DIR
256 else: 253 else:
257 test_dir_prefix = self.HTTP_DIR 254 test_dir_prefix = self.HTTP_DIR
258 255
259 relative_path = test_name[len(test_dir_prefix):] 256 relative_path = test_name[len(test_dir_prefix):]
260 hostname, insecure_port, secure_port = self._get_http_host_and_ports_for _test(test_name) 257 hostname, insecure_port, secure_port = self._get_http_host_and_ports_for _test(test_name)
261 258
262 if "/https/" in test_name or ".https." in test_name: 259 if "/https/" in test_name or ".https." in test_name:
263 return "https://%s:%d/%s" % (hostname, secure_port, relative_path) 260 return "https://%s:%d/%s" % (hostname, secure_port, relative_path)
264 return "http://%s:%d/%s" % (hostname, insecure_port, relative_path) 261 return "http://%s:%d/%s" % (hostname, insecure_port, relative_path)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 self._leaked = True 403 self._leaked = True
407 match = re.match('#LEAK - (\S+) pid (\d+) (.+)\n', error_line) 404 match = re.match('#LEAK - (\S+) pid (\d+) (.+)\n', error_line)
408 self._leak_log = match.group(3) 405 self._leak_log = match.group(3)
409 return self._leaked 406 return self._leaked
410 407
411 def _command_from_driver_input(self, driver_input): 408 def _command_from_driver_input(self, driver_input):
412 # FIXME: performance tests pass in full URLs instead of test names. 409 # FIXME: performance tests pass in full URLs instead of test names.
413 if driver_input.test_name.startswith( 410 if driver_input.test_name.startswith(
414 'http://') or driver_input.test_name.startswith('https://') or d river_input.test_name == ('about:blank'): 411 'http://') or driver_input.test_name.startswith('https://') or d river_input.test_name == ('about:blank'):
415 command = driver_input.test_name 412 command = driver_input.test_name
416 elif self.is_http_test(driver_input.test_name) or self._should_treat_as_ wpt_test(driver_input.test_name): 413 elif self.is_http_test(driver_input.test_name) or self._port.should_use_ wptserve(driver_input.test_name):
417 command = self.test_to_uri(driver_input.test_name) 414 command = self.test_to_uri(driver_input.test_name)
418 else: 415 else:
419 command = self._port.abspath_for_test(driver_input.test_name) 416 command = self._port.abspath_for_test(driver_input.test_name)
420 if sys.platform == 'cygwin': 417 if sys.platform == 'cygwin':
421 command = path.cygpath(command) 418 command = path.cygpath(command)
422 419
423 assert not driver_input.image_hash or driver_input.should_run_pixel_test 420 assert not driver_input.image_hash or driver_input.should_run_pixel_test
424 421
425 # ' is the separator between arguments. 422 # ' is the separator between arguments.
426 if self._port.supports_per_test_timeout(): 423 if self._port.supports_per_test_timeout():
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 self.decoded_content = None 541 self.decoded_content = None
545 self.malloc = None 542 self.malloc = None
546 self.js_heap = None 543 self.js_heap = None
547 self.stdin_path = None 544 self.stdin_path = None
548 545
549 def decode_content(self): 546 def decode_content(self):
550 if self.encoding == 'base64' and self.content is not None: 547 if self.encoding == 'base64' and self.content is not None:
551 self.decoded_content = base64.b64decode(self.content) 548 self.decoded_content = base64.b64decode(self.content)
552 else: 549 else:
553 self.decoded_content = self.content 550 self.decoded_content = self.content
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698