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

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

Issue 398543005: Revert of Modifications to layout test framework so that it can work with browser_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 def run_test(self, driver_input, stop_when_done): 143 def run_test(self, driver_input, stop_when_done):
144 """Run a single test and return the results. 144 """Run a single test and return the results.
145 145
146 Note that it is okay if a test times out or crashes and leaves 146 Note that it is okay if a test times out or crashes and leaves
147 the driver in an indeterminate state. The upper layers of the program 147 the driver in an indeterminate state. The upper layers of the program
148 are responsible for cleaning up and ensuring things are okay. 148 are responsible for cleaning up and ensuring things are okay.
149 149
150 Returns a DriverOutput object. 150 Returns a DriverOutput object.
151 """ 151 """
152 start_time = time.time() 152 start_time = time.time()
153 stdin_deadline = start_time + int(driver_input.timeout) / 2000.0 153 self.start(driver_input.should_run_pixel_test, driver_input.args)
154 self.start(driver_input.should_run_pixel_test, driver_input.args, stdin_ deadline)
155 test_begin_time = time.time() 154 test_begin_time = time.time()
156 self.error_from_test = str() 155 self.error_from_test = str()
157 self.err_seen_eof = False 156 self.err_seen_eof = False
158 157
159 command = self._command_from_driver_input(driver_input) 158 command = self._command_from_driver_input(driver_input)
160 deadline = test_begin_time + int(driver_input.timeout) / 1000.0 159 deadline = test_begin_time + int(driver_input.timeout) / 1000.0
161 160
162 self._server_process.write(command) 161 self._server_process.write(command)
163 text, audio = self._read_first_block(deadline) # First block is either text or audio 162 text, audio = self._read_first_block(deadline) # First block is either text or audio
164 image, actual_image_hash = self._read_optional_image_block(deadline) # The second (optional) block is image data. 163 image, actual_image_hash = self._read_optional_image_block(deadline) # The second (optional) block is image data.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if self._server_process is None: 258 if self._server_process is None:
260 return False 259 return False
261 if self._crashed_process_name: 260 if self._crashed_process_name:
262 return True 261 return True
263 if self._server_process.has_crashed(): 262 if self._server_process.has_crashed():
264 self._crashed_process_name = self._server_process.name() 263 self._crashed_process_name = self._server_process.name()
265 self._crashed_pid = self._server_process.pid() 264 self._crashed_pid = self._server_process.pid()
266 return True 265 return True
267 return False 266 return False
268 267
269 def start(self, pixel_tests, per_test_args, deadline): 268 def start(self, pixel_tests, per_test_args):
270 new_cmd_line = self.cmd_line(pixel_tests, per_test_args) 269 new_cmd_line = self.cmd_line(pixel_tests, per_test_args)
271 if not self._server_process or new_cmd_line != self._current_cmd_line: 270 if not self._server_process or new_cmd_line != self._current_cmd_line:
272 self._start(pixel_tests, per_test_args) 271 self._start(pixel_tests, per_test_args)
273 self._run_post_start_tasks() 272 self._run_post_start_tasks()
274 273
275 def _setup_environ_for_driver(self, environment): 274 def _setup_environ_for_driver(self, environment):
276 if self._profiler: 275 if self._profiler:
277 environment = self._profiler.adjusted_environment(environment) 276 environment = self._profiler.adjusted_environment(environment)
278 return environment 277 return environment
279 278
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 setattr(block, header_attr, value) 423 setattr(block, header_attr, value)
425 return True 424 return True
426 return False 425 return False
427 426
428 def _process_stdout_line(self, block, line): 427 def _process_stdout_line(self, block, line):
429 if (self._read_header(block, line, 'Content-Type: ', 'content_type') 428 if (self._read_header(block, line, 'Content-Type: ', 'content_type')
430 or self._read_header(block, line, 'Content-Transfer-Encoding: ', 'en coding') 429 or self._read_header(block, line, 'Content-Transfer-Encoding: ', 'en coding')
431 or self._read_header(block, line, 'Content-Length: ', '_content_leng th', int) 430 or self._read_header(block, line, 'Content-Length: ', '_content_leng th', int)
432 or self._read_header(block, line, 'ActualHash: ', 'content_hash') 431 or self._read_header(block, line, 'ActualHash: ', 'content_hash')
433 or self._read_header(block, line, 'DumpMalloc: ', 'malloc') 432 or self._read_header(block, line, 'DumpMalloc: ', 'malloc')
434 or self._read_header(block, line, 'DumpJSHeap: ', 'js_heap') 433 or self._read_header(block, line, 'DumpJSHeap: ', 'js_heap')):
435 or self._read_header(block, line, 'StdinPath', 'stdin_path')):
436 return 434 return
437 # Note, we're not reading ExpectedHash: here, but we could. 435 # Note, we're not reading ExpectedHash: here, but we could.
438 # If the line wasn't a header, we just append it to the content. 436 # If the line wasn't a header, we just append it to the content.
439 block.content += line 437 block.content += line
440 438
441 def _strip_eof(self, line): 439 def _strip_eof(self, line):
442 if line and line.endswith("#EOF\n"): 440 if line and line.endswith("#EOF\n"):
443 return line[:-5], True 441 return line[:-5], True
444 if line and line.endswith("#EOF\r\n"): 442 if line and line.endswith("#EOF\r\n"):
445 _log.error("Got a CRLF-terminated #EOF - this is a driver bug.") 443 _log.error("Got a CRLF-terminated #EOF - this is a driver bug.")
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 def __init__(self): 500 def __init__(self):
503 self.content_type = None 501 self.content_type = None
504 self.encoding = None 502 self.encoding = None
505 self.content_hash = None 503 self.content_hash = None
506 self._content_length = None 504 self._content_length = None
507 # Content is treated as binary data even though the text output is usual ly UTF-8. 505 # Content is treated as binary data even though the text output is usual ly UTF-8.
508 self.content = str() # FIXME: Should be bytearray() once we require Pyt hon 2.6. 506 self.content = str() # FIXME: Should be bytearray() once we require Pyt hon 2.6.
509 self.decoded_content = None 507 self.decoded_content = None
510 self.malloc = None 508 self.malloc = None
511 self.js_heap = None 509 self.js_heap = None
512 self.stdin_path = None
513 510
514 def decode_content(self): 511 def decode_content(self):
515 if self.encoding == 'base64' and self.content is not None: 512 if self.encoding == 'base64' and self.content is not None:
516 self.decoded_content = base64.b64decode(self.content) 513 self.decoded_content = base64.b64decode(self.content)
517 else: 514 else:
518 self.decoded_content = self.content 515 self.decoded_content = self.content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698