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

Side by Side Diff: build/android/pylib/screenshot.py

Issue 1141833003: [Android] Remove adb_commands from telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (last?) rebase Created 5 years, 6 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 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import tempfile 7 import tempfile
8 import time 8 import time
9 9
10 from pylib import cmd_helper 10 from pylib import cmd_helper
11 from pylib import constants
11 from pylib import device_signal 12 from pylib import device_signal
12 from pylib.device import device_errors 13 from pylib.device import device_errors
13 14
14 # TODO(jbudorick) Remove once telemetry gets switched over. 15 # TODO(jbudorick) Remove once telemetry gets switched over.
15 import pylib.android_commands 16 import pylib.android_commands
16 import pylib.device.device_utils 17 import pylib.device.device_utils
17 18
18 19
19 class VideoRecorder(object): 20 class VideoRecorder(object):
20 """Records a screen capture video from an Android Device (KitKat or newer). 21 """Records a screen capture video from an Android Device (KitKat or newer).
(...skipping 12 matching lines...) Expand all
33 # TODO(jbudorick) Remove once telemetry gets switched over. 34 # TODO(jbudorick) Remove once telemetry gets switched over.
34 if isinstance(device, pylib.android_commands.AndroidCommands): 35 if isinstance(device, pylib.android_commands.AndroidCommands):
35 device = pylib.device.device_utils.DeviceUtils(device) 36 device = pylib.device.device_utils.DeviceUtils(device)
36 self._device = device 37 self._device = device
37 self._device_file = ( 38 self._device_file = (
38 '%s/screen-recording.mp4' % device.GetExternalStoragePath()) 39 '%s/screen-recording.mp4' % device.GetExternalStoragePath())
39 self._recorder = None 40 self._recorder = None
40 self._recorder_stdout = None 41 self._recorder_stdout = None
41 self._is_started = False 42 self._is_started = False
42 43
43 self._args = ['adb'] 44 self._args = [constants.GetAdbPath()]
44 if str(self._device): 45 if str(self._device):
45 self._args += ['-s', str(self._device)] 46 self._args += ['-s', str(self._device)]
46 self._args += ['shell', 'screenrecord', '--verbose'] 47 self._args += ['shell', 'screenrecord', '--verbose']
47 self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)] 48 self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)]
48 if size: 49 if size:
49 self._args += ['--size', '%dx%d' % size] 50 self._args += ['--size', '%dx%d' % size]
50 if rotate: 51 if rotate:
51 self._args += ['--rotate'] 52 self._args += ['--rotate']
52 self._args += [self._device_file] 53 self._args += [self._device_file]
53 54
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 # TODO(jbudorick): Merge filename generation with the logic for doing so in 91 # TODO(jbudorick): Merge filename generation with the logic for doing so in
91 # DeviceUtils. 92 # DeviceUtils.
92 host_file_name = ( 93 host_file_name = (
93 host_file 94 host_file
94 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', 95 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S',
95 time.localtime())) 96 time.localtime()))
96 host_file_name = os.path.abspath(host_file_name) 97 host_file_name = os.path.abspath(host_file_name)
97 self._device.PullFile(self._device_file, host_file_name) 98 self._device.PullFile(self._device_file, host_file_name)
98 self._device.RunShellCommand('rm -f "%s"' % self._device_file) 99 self._device.RunShellCommand('rm -f "%s"' % self._device_file)
99 return host_file_name 100 return host_file_name
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | tools/telemetry/telemetry/core/android_process.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698