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

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

Issue 1112843002: [Android] Remove more uses of android_commands from build/android/pylib. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@detriplicated
Patch Set: fixes for host-driven tests & specific device Created 5 years, 8 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 46aec6fc9df0eb7b94b89628457567a692299b81..50d0334cde20e1ac7708613e95390c190f2e3752 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -175,6 +175,29 @@ class DeviceUtils(object):
assert hasattr(self, decorators.DEFAULT_TIMEOUT_ATTR)
assert hasattr(self, decorators.DEFAULT_RETRIES_ATTR)
+ def __eq__(self, other):
+ """Checks whether |other| refers to the same device as |self|.
+
+ Args:
+ other: The object to compare to. This can be a basestring, an instance
+ of adb_wrapper.AdbWrapper, or an instance of DeviceUtils.
+ Returns:
+ Whether |other| refers to the same device as |self|.
+ """
+ return self.adb.GetDeviceSerial() == str(other)
+
+ def __lt__(self, other):
+ """Compares two instances of DeviceUtils.
+
+ This merely compares their serial numbers.
+
+ Args:
+ other: The instance of DeviceUtils to compare to.
+ Returns:
+ Whether |self| is less than |other|.
+ """
+ return self.adb.GetDeviceSerial() < other.adb.GetDeviceSerial()
+
def __str__(self):
"""Returns the device serial."""
return self.adb.GetDeviceSerial()
@@ -535,7 +558,7 @@ class DeviceUtils(object):
with device_temp_file.DeviceTempFile(self.adb) as large_output_file:
cmd = '%s > %s' % (cmd, large_output_file.name)
logging.info('Large output mode enabled. Will write output to device '
- ' and read results from file.')
+ 'and read results from file.')
handle_large_command(cmd)
return self.ReadFile(large_output_file.name)
else:

Powered by Google App Engine
This is Rietveld 408576698