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

Unified Diff: build/android/pylib/device/device_utils.py

Issue 1281923003: [Android] Add --blacklist-file as a command-line option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index 2d9671d01034f64873c5c0ebd2b889f0e896703c..f693aac7e2c5139a8df40e4ade56e173e82d6e60 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -1766,7 +1766,7 @@ class DeviceUtils(object):
self._cache.clear()
@classmethod
- def parallel(cls, devices=None, async=False):
+ def parallel(cls, devices, async=False):
"""Creates a Parallelizer to operate over the provided list of devices.
If |devices| is either |None| or an empty list, the Parallelizer will
@@ -1783,9 +1783,7 @@ class DeviceUtils(object):
A Parallelizer operating over |devices|.
"""
if not devices:
- devices = cls.HealthyDevices()
- if not devices:
- raise device_errors.NoDevicesError()
+ raise device_errors.NoDevicesError()
devices = [d if isinstance(d, cls) else cls(d) for d in devices]
if async:
@@ -1794,10 +1792,14 @@ class DeviceUtils(object):
return parallelizer.SyncParallelizer(devices)
@classmethod
- def HealthyDevices(cls):
- blacklist = device_blacklist.ReadBlacklist()
+ def HealthyDevices(cls, blacklist=None):
+ if not blacklist:
jbudorick 2015/08/13 17:38:17 Ethan: the None blacklist currently gets handled h
+ # TODO(jbudorick): Remove once clients pass in the blacklist.
+ blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON)
+
+ blacklisted_devices = blacklist.Read()
def blacklisted(adb):
- if adb.GetDeviceSerial() in blacklist:
+ if adb.GetDeviceSerial() in blacklisted_devices:
logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial())
return True
return False

Powered by Google App Engine
This is Rietveld 408576698