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

Unified Diff: build/android/pylib/android_commands.py

Issue 11366068: Take screenshots using /system/bin/screencap instead of monkeyrunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed bulach's comments Created 8 years, 1 month 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/constants.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index c40870e40137971d8f3330ed66eddb7d9c1b4464..7972909ae31cac704e80f057c54893be857e84b1 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -1066,6 +1066,20 @@ class AndroidCommands(object):
return False
+ def TakeScreenshot(self, host_file):
+ """Saves a screenshot image to |host_file| on the host.
+
+ Args:
+ host_file: Absolute path to the image file to store on the host.
+ """
+ host_dir = os.path.dirname(host_file)
+ if not os.path.exists(host_dir):
+ os.mkdir(host_dir)
+ device_file = '%s/screenshot.png' % self.GetExternalStorage()
+ self.RunShellCommand('/system/bin/screencap -p %s' % device_file)
+ assert self._adb.Pull(device_file, host_file)
+ assert os.path.exists(host_file)
+
class NewLineNormalizer(object):
"""A file-like object to normalize EOLs to '\n'.
« no previous file with comments | « no previous file | build/android/pylib/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698