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

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

Issue 1079113002: [Android] Add a "quiet" flag so KillAll doesn't complain if no processes killed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 8 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 signal
8 import tempfile 7 import tempfile
9 8
10 from pylib import cmd_helper 9 from pylib import cmd_helper
10 from pylib import device_signal
11 from pylib.device import device_errors 11 from pylib.device import device_errors
12 12
13 # TODO(jbudorick) Remove once telemetry gets switched over. 13 # TODO(jbudorick) Remove once telemetry gets switched over.
14 import pylib.android_commands 14 import pylib.android_commands
15 import pylib.device.device_utils 15 import pylib.device.device_utils
16 16
17 17
18 class VideoRecorder(object): 18 class VideoRecorder(object):
19 """Records a screen capture video from an Android Device (KitKat or newer). 19 """Records a screen capture video from an Android Device (KitKat or newer).
20 20
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if self._is_started: 66 if self._is_started:
67 break 67 break
68 return self._is_started 68 return self._is_started
69 69
70 def Stop(self): 70 def Stop(self):
71 """Stop recording video.""" 71 """Stop recording video."""
72 os.remove(self._recorder_stdout) 72 os.remove(self._recorder_stdout)
73 self._is_started = False 73 self._is_started = False
74 if not self._recorder: 74 if not self._recorder:
75 return 75 return
76 try: 76 if not self._device.KillAll('screenrecord', signum=device_signal.SIGINT,
77 self._device.KillAll('screenrecord', signum=signal.SIGINT) 77 quiet=True):
78 except device_errors.CommandFailedError:
79 logging.warning('Nothing to kill: screenrecord was not running') 78 logging.warning('Nothing to kill: screenrecord was not running')
80 self._recorder.wait() 79 self._recorder.wait()
81 80
82 def Pull(self, host_file=None): 81 def Pull(self, host_file=None):
83 """Pull resulting video file from the device. 82 """Pull resulting video file from the device.
84 83
85 Args: 84 Args:
86 host_file: Path to the video file to store on the host. 85 host_file: Path to the video file to store on the host.
87 Returns: 86 Returns:
88 Output video file name on the host. 87 Output video file name on the host.
89 """ 88 """
90 host_file_name = host_file or ('screen-recording-%s.mp4' % 89 host_file_name = host_file or ('screen-recording-%s.mp4' %
91 self._device.old_interface.GetTimestamp()) 90 self._device.old_interface.GetTimestamp())
92 host_file_name = os.path.abspath(host_file_name) 91 host_file_name = os.path.abspath(host_file_name)
93 self._device.old_interface.EnsureHostDirectory(host_file_name) 92 self._device.old_interface.EnsureHostDirectory(host_file_name)
94 self._device.PullFile(self._device_file, host_file_name) 93 self._device.PullFile(self._device_file, host_file_name)
95 self._device.RunShellCommand('rm -f "%s"' % self._device_file) 94 self._device.RunShellCommand('rm -f "%s"' % self._device_file)
96 return host_file_name 95 return host_file_name
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_package_exe.py ('k') | tools/telemetry/telemetry/core/platform/android_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698