Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py

Issue 2399613002: Don't access Port._filesystem directly (use Port.host.filesystem instead). (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1283
1284 self._clean_up_cmd_line() 1284 self._clean_up_cmd_line()
1285 1285
1286 def _pull_crash_dumps_from_device(self): 1286 def _pull_crash_dumps_from_device(self):
1287 result = [] 1287 result = []
1288 if not self._android_commands.file_exists(self._driver_details.device_cr ash_dumps_directory()): 1288 if not self._android_commands.file_exists(self._driver_details.device_cr ash_dumps_directory()):
1289 return result 1289 return result
1290 dumps = self._android_commands.run(['shell', 'ls', self._driver_details. device_crash_dumps_directory()]) 1290 dumps = self._android_commands.run(['shell', 'ls', self._driver_details. device_crash_dumps_directory()])
1291 for dump in dumps.splitlines(): 1291 for dump in dumps.splitlines():
1292 device_dump = '%s/%s' % (self._driver_details.device_crash_dumps_dir ectory(), dump) 1292 device_dump = '%s/%s' % (self._driver_details.device_crash_dumps_dir ectory(), dump)
1293 local_dump = self._port._filesystem.join(self._port._dump_reader.cra sh_dumps_directory(), dump) 1293 local_dump = self._port.host.filesystem.join(
1294 self._port._dump_reader.crash_dumps_directory(), dump) # pylint : disable=protected-access
1294 1295
1295 # FIXME: crbug.com/321489. Figure out why these commands would fail ... 1296 # FIXME: crbug.com/321489. Figure out why these commands would fail ...
1296 err = self._android_commands.run(['shell', 'chmod', '777', device_du mp]) 1297 err = self._android_commands.run(['shell', 'chmod', '777', device_du mp])
1297 if not err: 1298 if not err:
1298 self._android_commands.pull(device_dump, local_dump) 1299 self._android_commands.pull(device_dump, local_dump)
1299 if not err: 1300 if not err:
1300 self._android_commands.run(['shell', 'rm', '-f', device_dump]) 1301 self._android_commands.run(['shell', 'rm', '-f', device_dump])
1301 1302
1302 if self._port._filesystem.exists(local_dump): 1303 if self._port.host.filesystem.exists(local_dump):
1303 result.append(local_dump) 1304 result.append(local_dump)
1304 return result 1305 return result
1305 1306
1306 def _clean_up_cmd_line(self): 1307 def _clean_up_cmd_line(self):
1307 if not self._created_cmd_line: 1308 if not self._created_cmd_line:
1308 return 1309 return
1309 1310
1310 cmd_line_file_path = self._driver_details.command_line_file() 1311 cmd_line_file_path = self._driver_details.command_line_file()
1311 original_cmd_line_file_path = cmd_line_file_path + '.orig' 1312 original_cmd_line_file_path = cmd_line_file_path + '.orig'
1312 if self._android_commands.file_exists(original_cmd_line_file_path): 1313 if self._android_commands.file_exists(original_cmd_line_file_path):
1313 self._android_commands.run(['shell', 'mv', original_cmd_line_file_pa th, cmd_line_file_path]) 1314 self._android_commands.run(['shell', 'mv', original_cmd_line_file_pa th, cmd_line_file_path])
1314 elif self._android_commands.file_exists(cmd_line_file_path): 1315 elif self._android_commands.file_exists(cmd_line_file_path):
1315 self._android_commands.run(['shell', 'rm', cmd_line_file_path]) 1316 self._android_commands.run(['shell', 'rm', cmd_line_file_path])
1316 self._created_cmd_line = False 1317 self._created_cmd_line = False
1317 1318
1318 def _command_from_driver_input(self, driver_input): 1319 def _command_from_driver_input(self, driver_input):
1319 command = super(ChromiumAndroidDriver, self)._command_from_driver_input( driver_input) 1320 command = super(ChromiumAndroidDriver, self)._command_from_driver_input( driver_input)
1320 if command.startswith('/'): 1321 if command.startswith('/'):
1321 fs = self._port._filesystem 1322 fs = self._port.host.filesystem
1322 # FIXME: what happens if command lies outside of the layout_tests_di r on the host? 1323 # FIXME: what happens if command lies outside of the layout_tests_di r on the host?
1323 relative_test_filename = fs.relpath(command, fs.dirname(self._port.l ayout_tests_dir())) 1324 relative_test_filename = fs.relpath(command, fs.dirname(self._port.l ayout_tests_dir()))
1324 command = DEVICE_WEBKIT_BASE_DIR + relative_test_filename 1325 command = DEVICE_WEBKIT_BASE_DIR + relative_test_filename
1325 return command 1326 return command
1326 1327
1327 def _read_prompt(self, deadline): 1328 def _read_prompt(self, deadline):
1328 last_char = '' 1329 last_char = ''
1329 while True: 1330 while True:
1330 current_char = self._server_process.read_stdout(deadline, 1) 1331 current_char = self._server_process.read_stdout(deadline, 1)
1331 if current_char == ' ': 1332 if current_char == ' ':
1332 if last_char in ('#', '$'): 1333 if last_char in ('#', '$'):
1333 return 1334 return
1334 last_char = current_char 1335 last_char = current_char
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698