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

Unified Diff: build/android/screenshot.py

Issue 11470004: [Android] Add screenshot command line tool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/monkeyrunner_screenshot.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/screenshot.py
diff --git a/build/android/screenshot.py b/build/android/screenshot.py
new file mode 100755
index 0000000000000000000000000000000000000000..6e9575dd47b5d4998cb03cb00e3e500ba796e6ee
--- /dev/null
+++ b/build/android/screenshot.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Takes and saves a screenshot from an Android device.
+
+Usage: screenshot.py [-s SERIAL] [-f FILE]
+
+Options:
+ -s SERIAL connect to device with specified SERIAL
+ -f FILE write screenshot to FILE (default: Screenshot.png)
+"""
+
+from optparse import OptionParser
+import os
+import sys
+
+from pylib import android_commands
frankf 2012/12/06 21:44:42 Two blank lines here.
+
+def main(argv):
+ # Parse options.
+ parser = OptionParser()
+ parser.add_option("-s", "--serial", dest="serial",
frankf 2012/12/06 21:44:42 Use single quotes for consistency.
frankf 2012/12/06 21:50:14 Also, how does this behave if no serial is given a
+ help="connect to device with specified SERIAL",
+ metavar="SERIAL", default=None)
+ parser.add_option("-f", "--file", dest="filename",
+ help="write screenshot to FILE (default: %default)",
+ metavar="FILE", default="Screenshot.png")
+ (options, args) = parser.parse_args(argv)
+
+ # Grab screenshot and write to disk.
+ filename = os.path.abspath(options.filename)
+ ac = android_commands.AndroidCommands(options.serial)
+ ac.TakeScreenshot(filename)
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
« no previous file with comments | « build/android/monkeyrunner_screenshot.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698