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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 Works for files and directories. This method skips copying any paths in | 589 Works for files and directories. This method skips copying any paths in |
590 |test_data_paths| that already exist on the device with the same hash. | 590 |test_data_paths| that already exist on the device with the same hash. |
591 | 591 |
592 All pushed files can be removed by calling RemovePushedFiles(). | 592 All pushed files can be removed by calling RemovePushedFiles(). |
593 """ | 593 """ |
594 assert os.path.exists(local_path), 'Local path not found %s' % local_path | 594 assert os.path.exists(local_path), 'Local path not found %s' % local_path |
595 | 595 |
596 if not self._md5sum_path: | 596 if not self._md5sum_path: |
597 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') | 597 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') |
598 md5sum_path = '%s/out/%s/md5sum_bin' % (CHROME_SRC, default_build_type) | 598 md5sum_path = '%s/%s/md5sum_bin' % (cmd_helper.OutDirectory.get(), |
| 599 default_build_type) |
599 if not os.path.exists(md5sum_path): | 600 if not os.path.exists(md5sum_path): |
600 md5sum_path = '%s/out/Release/md5sum_bin' % (CHROME_SRC) | 601 md5sum_path = '%s/Release/md5sum_bin' % cmd_helper.OutDirectory.get() |
601 if not os.path.exists(md5sum_path): | 602 if not os.path.exists(md5sum_path): |
602 print >> sys.stderr, 'Please build md5sum.' | 603 print >> sys.stderr, 'Please build md5sum.' |
603 sys.exit(1) | 604 sys.exit(1) |
604 command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH) | 605 command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH) |
605 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) | 606 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) |
606 self._md5sum_path = md5sum_path | 607 self._md5sum_path = md5sum_path |
607 | 608 |
608 self._pushed_files.append(device_path) | 609 self._pushed_files.append(device_path) |
609 hashes_on_device = _ComputeFileListHash( | 610 hashes_on_device = _ComputeFileListHash( |
610 self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path)) | 611 self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path)) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 """ | 1093 """ |
1093 def __init__(self, output): | 1094 def __init__(self, output): |
1094 self._output = output | 1095 self._output = output |
1095 | 1096 |
1096 def write(self, data): | 1097 def write(self, data): |
1097 data = data.replace('\r\r\n', '\n') | 1098 data = data.replace('\r\r\n', '\n') |
1098 self._output.write(data) | 1099 self._output.write(data) |
1099 | 1100 |
1100 def flush(self): | 1101 def flush(self): |
1101 self._output.flush() | 1102 self._output.flush() |
OLD | NEW |