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