OLD | NEW |
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 os | 5 import os |
6 import tempfile | 6 import tempfile |
7 import time | 7 import time |
8 | 8 |
9 import android_commands | 9 from pylib import cmd_helper |
10 import cmd_helper | |
11 | 10 |
12 | 11 |
13 def _GetTimestamp(): | 12 def _GetTimestamp(): |
14 return time.strftime('%Y-%m-%d-%H%M%S', time.localtime()) | 13 return time.strftime('%Y-%m-%d-%H%M%S', time.localtime()) |
15 | 14 |
16 | 15 |
17 def _EnsureHostDirectory(host_file): | 16 def _EnsureHostDirectory(host_file): |
18 host_dir = os.path.dirname(os.path.abspath(host_file)) | 17 host_dir = os.path.dirname(os.path.abspath(host_file)) |
19 if not os.path.exists(host_dir): | 18 if not os.path.exists(host_dir): |
20 os.makedirs(host_dir) | 19 os.makedirs(host_dir) |
21 | 20 |
22 | 21 |
23 def TakeScreenshot(adb, host_file): | 22 def TakeScreenshot(adb, host_file): |
24 """Saves a screenshot image to |host_file| on the host. | 23 """Saves a screenshot image to |host_file| on the host. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 100 |
102 def Pull(self): | 101 def Pull(self): |
103 """Pull resulting video file from the device. | 102 """Pull resulting video file from the device. |
104 | 103 |
105 Returns: | 104 Returns: |
106 Output video file name on the host. | 105 Output video file name on the host. |
107 """ | 106 """ |
108 self._adb.PullFileFromDevice(self._device_file, self._host_file) | 107 self._adb.PullFileFromDevice(self._device_file, self._host_file) |
109 self._adb.RunShellCommand('rm -f "%s"' % self._device_file) | 108 self._adb.RunShellCommand('rm -f "%s"' % self._device_file) |
110 return self._host_file | 109 return self._host_file |
OLD | NEW |