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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 self._android_commands.file_exists(self._err_fifo_path)) | 1064 self._android_commands.file_exists(self._err_fifo_path)) |
1065 | 1065 |
1066 def _remove_all_pipes(self): | 1066 def _remove_all_pipes(self): |
1067 for file in [self._in_fifo_path, self._out_fifo_path, self._err_fifo_pat
h]: | 1067 for file in [self._in_fifo_path, self._out_fifo_path, self._err_fifo_pat
h]: |
1068 self._android_commands.run(['shell', 'rm', file]) | 1068 self._android_commands.run(['shell', 'rm', file]) |
1069 | 1069 |
1070 return (not self._android_commands.file_exists(self._in_fifo_path) and | 1070 return (not self._android_commands.file_exists(self._in_fifo_path) and |
1071 not self._android_commands.file_exists(self._out_fifo_path) and | 1071 not self._android_commands.file_exists(self._out_fifo_path) and |
1072 not self._android_commands.file_exists(self._err_fifo_path)) | 1072 not self._android_commands.file_exists(self._err_fifo_path)) |
1073 | 1073 |
1074 def start(self, pixel_tests, per_test_args): | 1074 def start(self, pixel_tests, per_test_args, deadline): |
1075 # We override the default start() so that we can call _android_driver_cm
d_line() | 1075 # We override the default start() so that we can call _android_driver_cm
d_line() |
1076 # instead of cmd_line(). | 1076 # instead of cmd_line(). |
1077 new_cmd_line = self._android_driver_cmd_line(pixel_tests, per_test_args) | 1077 new_cmd_line = self._android_driver_cmd_line(pixel_tests, per_test_args) |
1078 | 1078 |
1079 # Since _android_driver_cmd_line() is different than cmd_line() we need
to provide | 1079 # Since _android_driver_cmd_line() is different than cmd_line() we need
to provide |
1080 # our own mechanism for detecting when the process should be stopped. | 1080 # our own mechanism for detecting when the process should be stopped. |
1081 if self._current_cmd_line is None: | 1081 if self._current_cmd_line is None: |
1082 self._current_android_cmd_line = None | 1082 self._current_android_cmd_line = None |
1083 if new_cmd_line != self._current_android_cmd_line: | 1083 if new_cmd_line != self._current_android_cmd_line: |
1084 self.stop() | 1084 self.stop() |
1085 self._current_android_cmd_line = new_cmd_line | 1085 self._current_android_cmd_line = new_cmd_line |
1086 | 1086 |
1087 super(ChromiumAndroidDriver, self).start(pixel_tests, per_test_args) | 1087 super(ChromiumAndroidDriver, self).start(pixel_tests, per_test_args, dea
dline) |
1088 | 1088 |
1089 def _start(self, pixel_tests, per_test_args): | 1089 def _start(self, pixel_tests, per_test_args): |
1090 if not self._android_devices.is_device_prepared(self._android_commands.g
et_serial()): | 1090 if not self._android_devices.is_device_prepared(self._android_commands.g
et_serial()): |
1091 raise driver.DeviceFailure("%s is not prepared in _start()" % self._
android_commands.get_serial()) | 1091 raise driver.DeviceFailure("%s is not prepared in _start()" % self._
android_commands.get_serial()) |
1092 | 1092 |
1093 for retries in range(3): | 1093 for retries in range(3): |
1094 try: | 1094 try: |
1095 if self._start_once(pixel_tests, per_test_args): | 1095 if self._start_once(pixel_tests, per_test_args): |
1096 return | 1096 return |
1097 except ScriptError as e: | 1097 except ScriptError as e: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 return command | 1268 return command |
1269 | 1269 |
1270 def _read_prompt(self, deadline): | 1270 def _read_prompt(self, deadline): |
1271 last_char = '' | 1271 last_char = '' |
1272 while True: | 1272 while True: |
1273 current_char = self._server_process.read_stdout(deadline, 1) | 1273 current_char = self._server_process.read_stdout(deadline, 1) |
1274 if current_char == ' ': | 1274 if current_char == ' ': |
1275 if last_char in ('#', '$'): | 1275 if last_char in ('#', '$'): |
1276 return | 1276 return |
1277 last_char = current_char | 1277 last_char = current_char |
OLD | NEW |