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

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

Issue 371813005: [Android] Switch to DeviceUtils versions of Ls, SetJavaAsserts, GetProp, and SetProp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 28d258f4d12a080d604d16a4924315dfa47da505..ee8493676489e68b19cf137e70d29ca5524dea52 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -546,6 +546,62 @@ class DeviceUtils(object):
else:
self.old_interface.SetFileContents(device_path, contents)
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def Ls(self, device_path, as_root=False, timeout=None, retries=None):
+ """Lists the contents of a directory on the device.
+
+ Args:
+ device_path: A string containing the path of the directory on the device
+ to list.
+ as_root: A boolean inidcating whether the ls should be executed with root
+ priveleges.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ Returns:
+ The contents of the directory specified by |device_path|.
+ """
+ return self.old_interface.ListPathContents(device_path)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def SetJavaAsserts(self, enabled, timeout=None, retries=None):
+ """Enables or disables Java asserts.
+
+ Args:
+ enabled: A boolean indicating whether Java asserts should be enabled
+ or disabled.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.SetJavaAssertsEnabled(enabled)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def GetProp(self, property_name, timeout=None, retries=None):
+ """Gets a property from the device.
+
+ Args:
+ property_name: A string containing the name of the property to get from
+ the device.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ Returns:
+ The value of the device's |property_name| property.
+ """
+ return self.old_interface.system_properties[property_name]
tonyg 2014/07/07 15:22:56 Really up to you, but I thought it'd be more pytho
jbudorick 2014/07/07 16:12:45 I think I prefer GetProp / SetProp over the dict i
frankf 2014/07/07 17:29:03 I agree with John, explicit setter/getter in this
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def SetProp(self, property_name, value, timeout=None, retries=None):
+ """Sets a property on the device.
+
+ Args:
+ property_name: A string containing the name of the property to set on
+ the device.
+ value: A string containing the value to set to the property on the
+ device.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.system_properties[property_name] = value
+
def __str__(self):
"""Returns the device serial."""
return self.old_interface.GetDevice()

Powered by Google App Engine
This is Rietveld 408576698