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

Side by Side Diff: telemetry/telemetry/internal/platform/device_finder.py

Issue 2988553002: Fixed errors related to bad-continuation pt.11 (Closed)
Patch Set: Fix additional errors Created 3 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 | « telemetry/telemetry/internal/platform/cros_platform_backend_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Finds devices that can be controlled by telemetry.""" 5 """Finds devices that can be controlled by telemetry."""
6 6
7 from telemetry.internal.platform import android_device 7 from telemetry.internal.platform import android_device
8 from telemetry.internal.platform import cros_device 8 from telemetry.internal.platform import cros_device
9 from telemetry.internal.platform import desktop_device 9 from telemetry.internal.platform import desktop_device
10 10
11 DEVICES = [ 11 DEVICES = [
12 android_device, 12 android_device,
13 cros_device, 13 cros_device,
14 desktop_device, 14 desktop_device,
15 ] 15 ]
16 16
17 17
18 def _GetAllAvailableDevices(options): 18 def _GetAllAvailableDevices(options):
19 """Returns a list of all available devices.""" 19 """Returns a list of all available devices."""
20 devices = [] 20 devices = []
21 for device in DEVICES: 21 for device in DEVICES:
22 devices.extend(device.FindAllAvailableDevices(options)) 22 devices.extend(device.FindAllAvailableDevices(options))
23 return devices 23 return devices
24 24
25 25
26 def GetDevicesMatchingOptions(options): 26 def GetDevicesMatchingOptions(options):
27 """Returns a list of devices matching the options.""" 27 """Returns a list of devices matching the options."""
28 devices = [] 28 devices = []
29 remote_platform_options = options.remote_platform_options 29 remote_platform_options = options.remote_platform_options
30 if (not remote_platform_options.device or 30 if (not remote_platform_options.device or
31 remote_platform_options.device == 'list'): 31 remote_platform_options.device == 'list'):
32 devices = _GetAllAvailableDevices(options) 32 devices = _GetAllAvailableDevices(options)
33 elif remote_platform_options.device == 'android': 33 elif remote_platform_options.device == 'android':
34 devices = android_device.FindAllAvailableDevices(options) 34 devices = android_device.FindAllAvailableDevices(options)
35 else: 35 else:
36 devices = _GetAllAvailableDevices(options) 36 devices = _GetAllAvailableDevices(options)
37 devices = [d for d in devices if d.guid == 37 devices = [d for d in devices if d.guid ==
38 options.remote_platform_options.device] 38 options.remote_platform_options.device]
39 39
40 devices.sort(key=lambda device: device.name) 40 devices.sort(key=lambda device: device.name)
41 return devices 41 return devices
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/platform/cros_platform_backend_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698