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

Unified Diff: build/android/devil/android/tools/script_common.py

Issue 1522313002: [Android] Move screenshot and video_recorder into devil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix video_recorder timing Created 5 years 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: build/android/devil/android/tools/script_common.py
diff --git a/build/android/devil/android/tools/script_common.py b/build/android/devil/android/tools/script_common.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb91cdcb9bffd88db4c9ce4b03df510994a5f449
--- /dev/null
+++ b/build/android/devil/android/tools/script_common.py
@@ -0,0 +1,28 @@
+# Copyright 2015 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.
+
+from devil.android import device_blacklist
+from devil.android import device_errors
+from devil.android import device_utils
+
+
+def GetDevices(requested_devices, blacklist_file):
+ blacklist = (device_blacklist.Blacklist(blacklist_file)
+ if blacklist_file
+ else None)
+
+ devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
+ if not devices:
+ raise device_errors.NoDevicesError()
+ elif requested_devices:
+ requested = set(requested_devices)
+ available = set(str(d) for d in devices)
+ missing = requested.difference(available)
+ if missing:
+ raise device_errors.DeviceUnreachableError(next(iter(missing)))
+ return sorted(device_utils.DeviceUtils(d)
+ for d in available.intersection(requested))
+ else:
+ return devices
+
« no previous file with comments | « build/android/devil/android/tools/screenshot.py ('k') | build/android/devil/android/tools/script_common_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698