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

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

Issue 762883002: Make device serial required in AdbWrapper/DeviceUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renamed: exclude -> ignore Created 6 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
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 272e613b6817f915a2cee039caf6ff53de13bea7..8d9b009a01a481b73b0c997dacb28575e9b816c6 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -65,8 +65,8 @@ class DeviceUtils(object):
"""DeviceUtils constructor.
Args:
- device: Either a device serial, an existing AdbWrapper instance, an
- an existing AndroidCommands instance, or nothing.
+ device: Either a device serial, an existing AdbWrapper instance, or an
+ an existing AndroidCommands instance.
default_timeout: An integer containing the default number of seconds to
wait for an operation to complete if no explicit value
is provided.
@@ -85,11 +85,8 @@ class DeviceUtils(object):
elif isinstance(device, pylib.android_commands.AndroidCommands):
self.adb = adb_wrapper.AdbWrapper(device.GetDevice())
self.old_interface = device
- elif not device:
- self.adb = adb_wrapper.AdbWrapper('')
- self.old_interface = pylib.android_commands.AndroidCommands()
else:
- raise ValueError('Unsupported type passed for argument "device"')
+ raise ValueError('Unsupported device value: %r' % device)
self._commands_installed = None
self._default_timeout = default_timeout
self._default_retries = default_retries
@@ -1132,12 +1129,7 @@ class DeviceUtils(object):
def __str__(self):
"""Returns the device serial."""
- s = self.old_interface.GetDevice()
- if not s:
- s = self.old_interface.Adb().GetSerialNumber()
- if s == 'unknown':
- raise device_errors.NoDevicesError()
- return s
+ return self.adb.GetDeviceSerial()
@staticmethod
def parallel(devices=None, async=False):
« no previous file with comments | « build/android/pylib/device/adb_wrapper.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698