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