| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
| 6 | 6 |
| 7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import collections | 10 import collections |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 self.RunShellCommand('pm clear ' + package) | 717 self.RunShellCommand('pm clear ' + package) |
| 718 | 718 |
| 719 def SendKeyEvent(self, keycode): | 719 def SendKeyEvent(self, keycode): |
| 720 """Sends keycode to the device. | 720 """Sends keycode to the device. |
| 721 | 721 |
| 722 Args: | 722 Args: |
| 723 keycode: Numeric keycode to send (see "enum" at top of file). | 723 keycode: Numeric keycode to send (see "enum" at top of file). |
| 724 """ | 724 """ |
| 725 self.RunShellCommand('input keyevent %d' % keycode) | 725 self.RunShellCommand('input keyevent %d' % keycode) |
| 726 | 726 |
| 727 def CheckMd5Sum(self, local_path, device_path, ignore_paths=False): | 727 def CheckMd5Sum(self, local_path, device_path): |
| 728 """Compares the md5sum of a local path against a device path. | 728 """Compares the md5sum of a local path against a device path. |
| 729 | 729 |
| 730 Args: | 730 Args: |
| 731 local_path: Path (file or directory) on the host. | 731 local_path: Path (file or directory) on the host. |
| 732 device_path: Path on the device. | 732 device_path: Path on the device. |
| 733 ignore_paths: If False, both the md5sum and the relative paths/names of | |
| 734 files must match. If True, only the md5sum must match. | |
| 735 | 733 |
| 736 Returns: | 734 Returns: |
| 737 True if the md5sums match. | 735 True if the md5sums match. |
| 738 """ | 736 """ |
| 739 if not self._md5sum_build_dir: | 737 if not self._md5sum_build_dir: |
| 740 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') | 738 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') |
| 741 build_dir = '%s/%s/' % ( | 739 build_dir = '%s/%s/' % ( |
| 742 cmd_helper.OutDirectory().get(), default_build_type) | 740 cmd_helper.OutDirectory().get(), default_build_type) |
| 743 md5sum_dist_path = '%s/md5sum_dist' % build_dir | 741 md5sum_dist_path = '%s/md5sum_dist' % build_dir |
| 744 if not os.path.exists(md5sum_dist_path): | 742 if not os.path.exists(md5sum_dist_path): |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 """ | 1458 """ |
| 1461 def __init__(self, output): | 1459 def __init__(self, output): |
| 1462 self._output = output | 1460 self._output = output |
| 1463 | 1461 |
| 1464 def write(self, data): | 1462 def write(self, data): |
| 1465 data = data.replace('\r\r\n', '\n') | 1463 data = data.replace('\r\r\n', '\n') |
| 1466 self._output.write(data) | 1464 self._output.write(data) |
| 1467 | 1465 |
| 1468 def flush(self): | 1466 def flush(self): |
| 1469 self._output.flush() | 1467 self._output.flush() |
| OLD | NEW |