OLD | NEW |
1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 889 |
890 def _start_once(self, pixel_tests, per_test_args): | 890 def _start_once(self, pixel_tests, per_test_args): |
891 super(ChromiumAndroidDriver, self)._start(pixel_tests, per_test_args) | 891 super(ChromiumAndroidDriver, self)._start(pixel_tests, per_test_args) |
892 | 892 |
893 self._log_debug('Starting forwarder') | 893 self._log_debug('Starting forwarder') |
894 self._forwarder_process = self._port._server_process_constructor( | 894 self._forwarder_process = self._port._server_process_constructor( |
895 self._port, 'Forwarder', self._android_commands.adb_command() + ['sh
ell', '%s -D %s' % (self._driver_details.device_forwarder_path(), FORWARD_PORTS)
]) | 895 self._port, 'Forwarder', self._android_commands.adb_command() + ['sh
ell', '%s -D %s' % (self._driver_details.device_forwarder_path(), FORWARD_PORTS)
]) |
896 self._forwarder_process.start() | 896 self._forwarder_process.start() |
897 | 897 |
898 self._android_commands.run(['logcat', '-c']) | 898 self._android_commands.run(['logcat', '-c']) |
899 self._android_commands.run(['shell', 'echo'] + self._cmd_line + ['>', se
lf._driver_details.command_line_file()]) | 899 self._android_commands.run(['shell', 'echo'] + self._android_driver_cmd_
line(pixel_tests, per_test_args) + ['>', self._driver_details.command_line_file(
)]) |
900 start_result = self._android_commands.run(['shell', 'am', 'start', '-e',
'RunInSubThread', '-n', self._driver_details.activity_name()]) | 900 start_result = self._android_commands.run(['shell', 'am', 'start', '-e',
'RunInSubThread', '-n', self._driver_details.activity_name()]) |
901 if start_result.find('Exception') != -1: | 901 if start_result.find('Exception') != -1: |
902 self._log_error('Failed to start the content_shell application. Exce
ption:\n' + start_result) | 902 self._log_error('Failed to start the content_shell application. Exce
ption:\n' + start_result) |
903 return False | 903 return False |
904 | 904 |
905 if not ChromiumAndroidDriver._loop_with_timeout(self._all_pipes_created,
DRIVER_START_STOP_TIMEOUT_SECS): | 905 if not ChromiumAndroidDriver._loop_with_timeout(self._all_pipes_created,
DRIVER_START_STOP_TIMEOUT_SECS): |
906 return False | 906 return False |
907 | 907 |
908 # Read back the shell prompt to ensure adb shell ready. | 908 # Read back the shell prompt to ensure adb shell ready. |
909 deadline = time.time() + DRIVER_START_STOP_TIMEOUT_SECS | 909 deadline = time.time() + DRIVER_START_STOP_TIMEOUT_SECS |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 return command | 1004 return command |
1005 | 1005 |
1006 def _read_prompt(self, deadline): | 1006 def _read_prompt(self, deadline): |
1007 last_char = '' | 1007 last_char = '' |
1008 while True: | 1008 while True: |
1009 current_char = self._server_process.read_stdout(deadline, 1) | 1009 current_char = self._server_process.read_stdout(deadline, 1) |
1010 if current_char == ' ': | 1010 if current_char == ' ': |
1011 if last_char in ('#', '$'): | 1011 if last_char in ('#', '$'): |
1012 return | 1012 return |
1013 last_char = current_char | 1013 last_char = current_char |
OLD | NEW |