OLD | NEW |
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 self._current_cmd_line = cmd_line | 325 self._current_cmd_line = cmd_line |
326 | 326 |
327 if wait_for_ready: | 327 if wait_for_ready: |
328 deadline = time.time() + DRIVER_START_TIMEOUT_SECS | 328 deadline = time.time() + DRIVER_START_TIMEOUT_SECS |
329 if not self._wait_for_server_process_output(self._server_process, de
adline, '#READY'): | 329 if not self._wait_for_server_process_output(self._server_process, de
adline, '#READY'): |
330 _log.error("content_shell took too long to startup.") | 330 _log.error("content_shell took too long to startup.") |
331 | 331 |
332 def _wait_for_server_process_output(self, server_process, deadline, text): | 332 def _wait_for_server_process_output(self, server_process, deadline, text): |
333 output = '' | 333 output = '' |
334 line = server_process.read_stdout_line(deadline) | 334 line = server_process.read_stdout_line(deadline) |
| 335 output += server_process.pop_all_buffered_stderr() |
335 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): | 336 while not server_process.timed_out and not server_process.has_crashed()
and not text in line.rstrip(): |
336 output += line | 337 output += line |
337 line = server_process.read_stdout_line(deadline) | 338 line = server_process.read_stdout_line(deadline) |
| 339 output += server_process.pop_all_buffered_stderr() |
338 | 340 |
339 if server_process.timed_out or server_process.has_crashed(): | 341 if server_process.timed_out or server_process.has_crashed(): |
340 _log.error('Failed to start the %s process: \n%s', server_process.na
me(), output) | 342 _log.error('Failed to start the %s process: \n%s', server_process.na
me(), output) |
341 return False | 343 return False |
342 | 344 |
343 return True | 345 return True |
344 | 346 |
345 def _run_post_start_tasks(self): | 347 def _run_post_start_tasks(self): |
346 # Remote drivers may override this to delay post-start tasks until the s
erver has ack'd. | 348 # Remote drivers may override this to delay post-start tasks until the s
erver has ack'd. |
347 if self._profiler: | 349 if self._profiler: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 self.decoded_content = None | 546 self.decoded_content = None |
545 self.malloc = None | 547 self.malloc = None |
546 self.js_heap = None | 548 self.js_heap = None |
547 self.stdin_path = None | 549 self.stdin_path = None |
548 | 550 |
549 def decode_content(self): | 551 def decode_content(self): |
550 if self.encoding == 'base64' and self.content is not None: | 552 if self.encoding == 'base64' and self.content is not None: |
551 self.decoded_content = base64.b64decode(self.content) | 553 self.decoded_content = base64.b64decode(self.content) |
552 else: | 554 else: |
553 self.decoded_content = self.content | 555 self.decoded_content = self.content |
OLD | NEW |