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

Unified Diff: tools/telemetry/telemetry/core/device_finder.py

Issue 760653002: Telemetry --device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/device_finder.py
diff --git a/tools/telemetry/telemetry/core/device_finder.py b/tools/telemetry/telemetry/core/device_finder.py
new file mode 100644
index 0000000000000000000000000000000000000000..dbe011558cbf5bc7eef9160ae86de7312690f17a
--- /dev/null
+++ b/tools/telemetry/telemetry/core/device_finder.py
@@ -0,0 +1,45 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Finds devices that can be controlled by telemetry."""
+
+import logging
+
+from telemetry.core.platform import android_device
+from telemetry.core.platform import cros_device
+from telemetry.core.platform import desktop_device
+from telemetry.core.platform import ios_device
+from telemetry.core.platform import trybot_device
+
+DEVICES = [
+ android_device,
+ cros_device,
+ desktop_device,
+ ios_device,
+ trybot_device,
+]
+
+
+def GetAllAvailableDevices(options):
+ """Returns a list of all available devices."""
+ devices = []
+ for device in DEVICES:
+ devices.extend(device.FindAllAvailableDevices(options))
+ devices.sort(key=lambda device: device.name)
+ return devices
+
+
+def GetAllAvailableDeviceNames(options):
+ """Returns a list of all available device names."""
+ devices = GetAllAvailableDevices(options)
+ device_names = [device.name for device in devices]
+ return device_names
+
+
+def GetSpecifiedDevices(options):
+ """Returns the specified devices."""
+ assert options.device and options.device != 'list'
+ devices = GetAllAvailableDevices(options)
+ devices = [d for d in devices if d.guid == options.device]
+ return devices
« no previous file with comments | « tools/telemetry/telemetry/core/browser_options.py ('k') | tools/telemetry/telemetry/core/platform/android_device.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698