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

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

Issue 386053002: [Android] Switch to DeviceUtils versions of GetPid, TakeScreenshot, and GetIoStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pre-review cleanup 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
« no previous file with comments | « no previous file | 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 47884725740151fb9b0acd1bf76f61fb6850d9de..642f89b04fad4d071fbc64f4faa678e12b0973c1 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -600,6 +600,47 @@ class DeviceUtils(object):
"""
self.old_interface.system_properties[property_name] = value
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def GetPid(self, process_name, timeout=None, retries=None):
frankf 2014/07/11 20:22:53 this should be plural to match the return value
jbudorick 2014/07/14 16:15:11 Done.
+ """Returns the PIDs of processes with the given name.
+
+ Note that the |process_name| is often the package name.
frankf 2014/07/11 20:29:07 Also isn't this the app package name and not the p
jbudorick 2014/07/14 16:15:11 Not necessarily, though it can be, e.g. these can
+
+ Args:
+ process_name: A string containing the process name to get the PIDs for.
+ timeout: Same as for |IsOnline|.
frankf 2014/07/11 20:22:53 I'd change all these to: timeout: timeout in <som
jbudorick 2014/07/14 16:15:11 I don't really have an objection to this, but...
frankf 2014/07/14 17:04:10 Yea, the spirit of that comment was to cut down on
jbudorick 2014/07/15 15:52:56 Makes sense.
+ retries: Same as for |IsOnline|.
+ Returns:
+ A list containing the PIDs of processes with the given name.
frankf 2014/07/11 20:22:53 are there any assumptions on the ordering here? Fo
jbudorick 2014/07/14 16:15:11 I don't think that the interface should guarantee
frankf 2014/07/14 17:04:10 For example, in monkey test runner, we take the fi
jbudorick 2014/07/15 15:52:56 Ah, ok. Switched to having GetPids return a dict
+ """
frankf 2014/07/11 20:22:53 you should add raises section to all methods
jbudorick 2014/07/14 16:15:11 Done.
+ return self.old_interface.ExtractPid(process_name)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def TakeScreenshot(self, host_path=None, timeout=None, retries=None):
+ """Takes a screenshot of the device.
+
+ Args:
+ host_path: A string containing the path on the host to save the
+ screenshot to. If None, a file name will be generated.
frankf 2014/07/11 20:22:53 is this a temp file?
jbudorick 2014/07/14 16:15:11 No. The AndroidCommands implementation uses ${PWD
frankf 2014/07/14 17:04:10 So my point was: is the user expected to clean thi
jbudorick 2014/07/15 15:52:56 Yes, the user is expected to clean up the screensh
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ Returns:
+ The name of the file on the host to which the screenshot was saved.
+ """
+ return self.old_interface.TakeScreenshot(host_path)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def GetIOStats(self, timeout=None, retries=None):
+ """Gets cumulative disk IO stats since boot for all processes.
+
+ Args:
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ Returns:
+ A dict containing |num_reads|, |num_writes|, |read_ms|, and |write_ms|.
+ """
+ return self.old_interface.GetIoStats()
+
def __str__(self):
"""Returns the device serial."""
return self.old_interface.GetDevice()
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698