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

Side by Side Diff: build/android/screenshot.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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Takes a screenshot or a screen video capture from an Android device.""" 7 """Takes a screenshot or a screen video capture from an Android device."""
8 8
9 import logging 9 import logging
10 import optparse 10 import optparse
11 import os 11 import os
12 import sys 12 import sys
13 13
14 from pylib import android_commands 14 from pylib import android_commands
15 from pylib import screenshot 15 from pylib import screenshot
16 from pylib.device import device_utils 16 from pylib.device import device_utils
17 17
18 def _PrintMessage(heading, eol='\n'): 18 def _PrintMessage(heading, eol='\n'):
19 sys.stdout.write('%s%s' % (heading, eol)) 19 sys.stdout.write('%s%s' % (heading, eol))
20 sys.stdout.flush() 20 sys.stdout.flush()
21 21
22 22
23 def _CaptureScreenshot(device, host_file): 23 def _CaptureScreenshot(device, host_file):
24 host_file = device.old_interface.TakeScreenshot(host_file) 24 host_file = device.TakeScreenshot(host_file)
25 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file)) 25 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file))
26 26
27 27
28 def _CaptureVideo(device, host_file, options): 28 def _CaptureVideo(device, host_file, options):
29 size = tuple(map(int, options.size.split('x'))) if options.size else None 29 size = tuple(map(int, options.size.split('x'))) if options.size else None
30 recorder = screenshot.VideoRecorder(device, 30 recorder = screenshot.VideoRecorder(device,
31 megabits_per_second=options.bitrate, 31 megabits_per_second=options.bitrate,
32 size=size, 32 size=size,
33 rotate=options.rotate) 33 rotate=options.rotate)
34 try: 34 try:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 if options.video: 81 if options.video:
82 _CaptureVideo(device, host_file, options) 82 _CaptureVideo(device, host_file, options)
83 else: 83 else:
84 _CaptureScreenshot(device, host_file) 84 _CaptureScreenshot(device, host_file)
85 return 0 85 return 0
86 86
87 87
88 if __name__ == '__main__': 88 if __name__ == '__main__':
89 sys.exit(main()) 89 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698