| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 """Gets the md5sum of a host path and device path. | 775 """Gets the md5sum of a host path and device path. |
| 776 | 776 |
| 777 Args: | 777 Args: |
| 778 host_path: Path (file or directory) on the host. | 778 host_path: Path (file or directory) on the host. |
| 779 device_path: Path on the device. | 779 device_path: Path on the device. |
| 780 | 780 |
| 781 Returns: | 781 Returns: |
| 782 A tuple containing lists of the host and device md5sum results as | 782 A tuple containing lists of the host and device md5sum results as |
| 783 created by _ParseMd5SumOutput(). | 783 created by _ParseMd5SumOutput(). |
| 784 """ | 784 """ |
| 785 md5sum_dist_path = os.path.join(constants.GetOutDirectory(), | 785 md5sum_dist_path = os.path.join(constants.GetOutDirectory(), 'md5sum_dist') |
| 786 'md5sum_dist') | |
| 787 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.' | 786 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.' |
| 788 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER) | 787 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER) |
| 789 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) | 788 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) |
| 790 | 789 |
| 791 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' + | 790 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' + |
| 792 MD5SUM_DEVICE_PATH + ' ' + device_path) | 791 MD5SUM_DEVICE_PATH + ' ' + device_path) |
| 793 device_hash_tuples = _ParseMd5SumOutput( | 792 device_hash_tuples = _ParseMd5SumOutput( |
| 794 self.RunShellCommand(cmd, timeout_time=2 * 60)) | 793 self.RunShellCommand(cmd, timeout_time=2 * 60)) |
| 795 assert os.path.exists(host_path), 'Local path not found %s' % host_path | 794 assert os.path.exists(host_path), 'Local path not found %s' % host_path |
| 796 md5sum_output = cmd_helper.GetCmdOutput( | 795 md5sum_output = cmd_helper.GetCmdOutput( |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 """ | 1544 """ |
| 1546 def __init__(self, output): | 1545 def __init__(self, output): |
| 1547 self._output = output | 1546 self._output = output |
| 1548 | 1547 |
| 1549 def write(self, data): | 1548 def write(self, data): |
| 1550 data = data.replace('\r\r\n', '\n') | 1549 data = data.replace('\r\r\n', '\n') |
| 1551 self._output.write(data) | 1550 self._output.write(data) |
| 1552 | 1551 |
| 1553 def flush(self): | 1552 def flush(self): |
| 1554 self._output.flush() | 1553 self._output.flush() |
| OLD | NEW |