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

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

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
(Empty)
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
3 # found in the LICENSE file.
4
5 """Finds devices that can be controlled by telemetry."""
6
7 from telemetry.internal.platform import android_device
8 from telemetry.internal.platform import cros_device
9 from telemetry.internal.platform import desktop_device
10 from telemetry.internal.platform import ios_device
11
12 DEVICES = [
13 android_device,
14 cros_device,
15 desktop_device,
16 ios_device,
17 ]
18
19
20 def _GetAllAvailableDevices(options):
21 """Returns a list of all available devices."""
22 devices = []
23 for device in DEVICES:
24 devices.extend(device.FindAllAvailableDevices(options))
25 return devices
26
27
28 def GetDevicesMatchingOptions(options):
29 """Returns a list of devices matching the options."""
30 devices = []
31 if not options.device or options.device == 'list':
32 devices = _GetAllAvailableDevices(options)
33 elif options.device == 'android':
34 devices = android_device.FindAllAvailableDevices(options)
35 else:
36 devices = _GetAllAvailableDevices(options)
37 devices = [d for d in devices if d.guid == options.device]
38
39 devices.sort(key=lambda device: device.name)
40 return devices
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698