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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return self.run(['pull', device_path, host_path], ignore_error=ignore_er
ror) | 216 return self.run(['pull', device_path, host_path], ignore_error=ignore_er
ror) |
217 | 217 |
218 def mkdir(self, device_path, chmod=None): | 218 def mkdir(self, device_path, chmod=None): |
219 self.run(['shell', 'mkdir', '-p', device_path]) | 219 self.run(['shell', 'mkdir', '-p', device_path]) |
220 if chmod: | 220 if chmod: |
221 self.run(['shell', 'chmod', chmod, device_path]) | 221 self.run(['shell', 'chmod', chmod, device_path]) |
222 | 222 |
223 def restart_adb(self): | 223 def restart_adb(self): |
224 pids = self.extract_pids('adbd') | 224 pids = self.extract_pids('adbd') |
225 if pids: | 225 if pids: |
226 output = self.run(['shell', 'kill', '-' + str(signal.SIGTERM)] + pid
s) | 226 self.run(['shell', 'kill', '-' + str(signal.SIGTERM)] + pids) |
227 self.run(['wait-for-device']) | 227 self.run(['wait-for-device']) |
228 | 228 |
229 def restart_as_root(self): | 229 def restart_as_root(self): |
230 output = self.run(['root']) | 230 output = self.run(['root']) |
231 if 'adbd is already running as root' in output: | 231 if 'adbd is already running as root' in output: |
232 return | 232 return |
233 | 233 |
234 elif not 'restarting adbd as root' in output: | 234 elif not 'restarting adbd as root' in output: |
235 self._log_error('Unrecognized output from adb root: %s' % output) | 235 self._log_error('Unrecognized output from adb root: %s' % output) |
236 | 236 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 self._android_commands.run(['uninstall', self._driver_details.package_na
me()]) | 980 self._android_commands.run(['uninstall', self._driver_details.package_na
me()]) |
981 driver_host_path = self._port._path_to_driver() | 981 driver_host_path = self._port._path_to_driver() |
982 log_callback("installing apk") | 982 log_callback("installing apk") |
983 install_result = self._android_commands.run(['install', driver_host_path
]) | 983 install_result = self._android_commands.run(['install', driver_host_path
]) |
984 if 'Success' not in install_result: | 984 if 'Success' not in install_result: |
985 self._abort('Failed to install %s onto device: %s' % (driver_host_pa
th, install_result)) | 985 self._abort('Failed to install %s onto device: %s' % (driver_host_pa
th, install_result)) |
986 | 986 |
987 def _push_fonts(self, log_callback): | 987 def _push_fonts(self, log_callback): |
988 path_to_ahem_font = self._port._build_path('AHEM____.TTF') | 988 path_to_ahem_font = self._port._build_path('AHEM____.TTF') |
989 self._push_file_if_needed(path_to_ahem_font, self._driver_details.device
_fonts_directory() + 'AHEM____.TTF', log_callback) | 989 self._push_file_if_needed(path_to_ahem_font, self._driver_details.device
_fonts_directory() + 'AHEM____.TTF', log_callback) |
990 for (host_dirs, font_file, package) in HOST_FONT_FILES: | 990 for (host_dirs, font_file, _) in HOST_FONT_FILES: |
991 for host_dir in host_dirs: | 991 for host_dir in host_dirs: |
992 host_font_path = host_dir + font_file | 992 host_font_path = host_dir + font_file |
993 if self._port._check_file_exists(host_font_path, '', more_loggin
g=False): | 993 if self._port._check_file_exists(host_font_path, '', more_loggin
g=False): |
994 self._push_file_if_needed( | 994 self._push_file_if_needed( |
995 host_font_path, self._driver_details.device_fonts_direct
ory() + font_file, log_callback) | 995 host_font_path, self._driver_details.device_fonts_direct
ory() + font_file, log_callback) |
996 | 996 |
997 def _push_test_resources(self, log_callback): | 997 def _push_test_resources(self, log_callback): |
998 for resource in TEST_RESOURCES_TO_PUSH: | 998 for resource in TEST_RESOURCES_TO_PUSH: |
999 self._push_file_if_needed(self._port.layout_tests_dir() + '/' + reso
urce, | 999 self._push_file_if_needed(self._port.layout_tests_dir() + '/' + reso
urce, |
1000 DEVICE_LAYOUT_TESTS_DIR + resource, log_ca
llback) | 1000 DEVICE_LAYOUT_TESTS_DIR + resource, log_ca
llback) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 return command | 1306 return command |
1307 | 1307 |
1308 def _read_prompt(self, deadline): | 1308 def _read_prompt(self, deadline): |
1309 last_char = '' | 1309 last_char = '' |
1310 while True: | 1310 while True: |
1311 current_char = self._server_process.read_stdout(deadline, 1) | 1311 current_char = self._server_process.read_stdout(deadline, 1) |
1312 if current_char == ' ': | 1312 if current_char == ' ': |
1313 if last_char in ('#', '$'): | 1313 if last_char in ('#', '$'): |
1314 return | 1314 return |
1315 last_char = current_char | 1315 last_char = current_char |
OLD | NEW |