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

Unified Diff: build/android/pylib/local/device/local_device_environment.py

Issue 1358593002: [Android] Switch gtests to platform mode. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 5 years, 3 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/local/device/local_device_environment.py
diff --git a/build/android/pylib/local/device/local_device_environment.py b/build/android/pylib/local/device/local_device_environment.py
index 1179039335ffc80dd5f6ec240e2aaff4bbe357fc..ee0ff987afd353f22095d06d3c52f4014dddcf44 100644
--- a/build/android/pylib/local/device/local_device_environment.py
+++ b/build/android/pylib/local/device/local_device_environment.py
@@ -2,6 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
+import threading
+
from devil.android import device_blacklist
from devil.android import device_errors
from devil.android import device_utils
@@ -17,6 +20,7 @@ class LocalDeviceEnvironment(environment.Environment):
if args.blacklist_file
else None)
self._device_serial = args.test_device
+ self._devices_lock = threading.Lock()
self._devices = []
self._max_tries = 1 + args.num_retries
self._tool_name = args.tool
@@ -38,11 +42,13 @@ class LocalDeviceEnvironment(environment.Environment):
@property
def devices(self):
+ if not self._devices:
+ raise device_errors.NoDevicesError()
return self._devices
@property
def parallel_devices(self):
- return parallelizer.SyncParallelizer(self._devices)
+ return parallelizer.SyncParallelizer(self.devices)
@property
def max_tries(self):
@@ -56,3 +62,15 @@ class LocalDeviceEnvironment(environment.Environment):
def TearDown(self):
pass
+ def BlacklistDevice(self, device):
+ if not self._blacklist:
+ logging.warning(
+ 'Attempted to blacklist %s, but no blacklist was provided.',
+ str(device))
+ return
+
+ device_serial = device.adb.GetDeviceSerial()
+ self._blacklist.Extend([device_serial])
+ with self._devices_lock:
+ self._devices = [d for d in self._devices if str(d) != device_serial]
+
« no previous file with comments | « build/android/pylib/gtest/test_package_apk.py ('k') | build/android/pylib/local/device/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698