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

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

Issue 2161913002: [blink][android] Fix --adb-device in the layout test runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix AndroidPortTest.test_default_child_processes Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return [int(n) for n in result.group(1).split('.')] 327 return [int(n) for n in result.group(1).split('.')]
328 328
329 329
330 # A class to encapsulate device status and information, such as the AndroidComma nds 330 # A class to encapsulate device status and information, such as the AndroidComma nds
331 # instances and whether the device has been set up. 331 # instances and whether the device has been set up.
332 class AndroidDevices(object): 332 class AndroidDevices(object):
333 # Percentage of battery a device needs to have in order for it to be conside red 333 # Percentage of battery a device needs to have in order for it to be conside red
334 # to participate in running the layout tests. 334 # to participate in running the layout tests.
335 MINIMUM_BATTERY_PERCENTAGE = 30 335 MINIMUM_BATTERY_PERCENTAGE = 30
336 336
337 def __init__(self, executive, default_device=None, debug_logging=False): 337 def __init__(self, default_devices=None, debug_logging=False):
338 self._usable_devices = [] 338 self._usable_devices = []
339 self._default_device = default_device 339 self._default_devices = default_devices
340 self._prepared_devices = [] 340 self._prepared_devices = []
341 self._debug_logging = debug_logging 341 self._debug_logging = debug_logging
342 342
343 def prepared_devices(self): 343 def prepared_devices(self):
344 return self._prepared_devices 344 return self._prepared_devices
345 345
346 def usable_devices(self, executive): 346 def usable_devices(self, executive):
347 if self._usable_devices: 347 if self._usable_devices:
348 return self._usable_devices 348 return self._usable_devices
349 349
350 if self._default_device: 350 if self._default_devices:
351 self._usable_devices = [AndroidCommands(executive, self._default_dev ice, self._debug_logging)] 351 self._usable_devices = [
352 AndroidCommands(executive, d, self._debug_logging)
353 for d in self._default_devices]
352 return self._usable_devices 354 return self._usable_devices
353 355
354 # Example "adb devices" command output: 356 # Example "adb devices" command output:
355 # List of devices attached 357 # List of devices attached
356 # 0123456789ABCDEF device 358 # 0123456789ABCDEF device
357 re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE) 359 re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE)
358 360
359 result = executive.run_command([AndroidCommands.adb_command_path(executi ve, debug_logging=self._debug_logging), 'devices'], 361 result = executive.run_command([AndroidCommands.adb_command_path(executi ve, debug_logging=self._debug_logging), 'devices'],
360 error_handler=executive.ignore_error, deb ug_logging=self._debug_logging) 362 error_handler=executive.ignore_error, deb ug_logging=self._debug_logging)
361 devices = re_device.findall(result) 363 devices = re_device.findall(result)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 432
431 if not self.get_option('disable_breakpad'): 433 if not self.get_option('disable_breakpad'):
432 self._dump_reader = DumpReaderAndroid(host, self._build_path()) 434 self._dump_reader = DumpReaderAndroid(host, self._build_path())
433 435
434 if self.driver_name() != self.CONTENT_SHELL_NAME: 436 if self.driver_name() != self.CONTENT_SHELL_NAME:
435 raise AssertionError('Layout tests on Android only support content_s hell as the driver.') 437 raise AssertionError('Layout tests on Android only support content_s hell as the driver.')
436 438
437 self._driver_details = ContentShellDriverDetails() 439 self._driver_details = ContentShellDriverDetails()
438 440
439 # Initialize the AndroidDevices class which tracks available devices. 441 # Initialize the AndroidDevices class which tracks available devices.
440 default_device = None 442 default_devices = None
441 if hasattr(self._options, 'adb_device') and len(self._options.adb_device ): 443 if hasattr(self._options, 'adb_devices') and len(self._options.adb_devic es):
442 default_device = self._options.adb_device 444 default_devices = self._options.adb_devices
443 445
444 self._debug_logging = self.get_option('android_logging') 446 self._debug_logging = self.get_option('android_logging')
445 self._devices = AndroidDevices(self._executive, default_device, self._de bug_logging) 447 self._devices = AndroidDevices(default_devices, self._debug_logging)
446 448
447 # Tell AndroidCommands where to search for the "adb" command. 449 # Tell AndroidCommands where to search for the "adb" command.
448 AndroidCommands.set_adb_command_path_options(['adb', 450 AndroidCommands.set_adb_command_path_options(['adb',
449 self.path_from_chromium_ba se('third_party', 'android_tools', 'sdk', 'platform-tools', 'adb')]) 451 self.path_from_chromium_ba se('third_party', 'android_tools', 'sdk', 'platform-tools', 'adb')])
450 452
451 prepared_devices = self.get_option('prepared_devices', []) 453 prepared_devices = self.get_option('prepared_devices', [])
452 for serial in prepared_devices: 454 for serial in prepared_devices:
453 self._devices.set_device_prepared(serial) 455 self._devices.set_device_prepared(serial)
454 456
455 def default_smoke_test_only(self): 457 def default_smoke_test_only(self):
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 return command 1307 return command
1306 1308
1307 def _read_prompt(self, deadline): 1309 def _read_prompt(self, deadline):
1308 last_char = '' 1310 last_char = ''
1309 while True: 1311 while True:
1310 current_char = self._server_process.read_stdout(deadline, 1) 1312 current_char = self._server_process.read_stdout(deadline, 1)
1311 if current_char == ' ': 1313 if current_char == ' ':
1312 if last_char in ('#', '$'): 1314 if last_char in ('#', '$'):
1313 return 1315 return
1314 last_char = current_char 1316 last_char = current_char
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698