| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return files | 171 return files |
| 172 | 172 |
| 173 | 173 |
| 174 def _ComputeFileListHash(md5sum_output): | 174 def _ComputeFileListHash(md5sum_output): |
| 175 """Returns a list of MD5 strings from the provided md5sum output.""" | 175 """Returns a list of MD5 strings from the provided md5sum output.""" |
| 176 return [line.split(' ')[0] for line in md5sum_output] | 176 return [line.split(' ')[0] for line in md5sum_output] |
| 177 | 177 |
| 178 | 178 |
| 179 def _HasAdbPushSucceeded(command_output): | 179 def _HasAdbPushSucceeded(command_output): |
| 180 """Returns whether adb push has succeeded from the provided output.""" | 180 """Returns whether adb push has succeeded from the provided output.""" |
| 181 # TODO(frankf): We should look at the return code instead of the command |
| 182 # output for many of the commands in this file. |
| 181 if not command_output: | 183 if not command_output: |
| 182 return False | 184 return True |
| 183 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)" | 185 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)" |
| 184 # Errors look like this: "failed to copy ... " | 186 # Errors look like this: "failed to copy ... " |
| 185 if not re.search('^[0-9]', command_output.splitlines()[-1]): | 187 if not re.search('^[0-9]', command_output.splitlines()[-1]): |
| 186 logging.critical('PUSH FAILED: ' + command_output) | 188 logging.critical('PUSH FAILED: ' + command_output) |
| 187 return False | 189 return False |
| 188 return True | 190 return True |
| 189 | 191 |
| 190 | 192 |
| 191 def GetLogTimestamp(log_line, year): | 193 def GetLogTimestamp(log_line, year): |
| 192 """Returns the timestamp of the given |log_line| in the given year.""" | 194 """Returns the timestamp of the given |log_line| in the given year.""" |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 """ | 1367 """ |
| 1366 def __init__(self, output): | 1368 def __init__(self, output): |
| 1367 self._output = output | 1369 self._output = output |
| 1368 | 1370 |
| 1369 def write(self, data): | 1371 def write(self, data): |
| 1370 data = data.replace('\r\r\n', '\n') | 1372 data = data.replace('\r\r\n', '\n') |
| 1371 self._output.write(data) | 1373 self._output.write(data) |
| 1372 | 1374 |
| 1373 def flush(self): | 1375 def flush(self): |
| 1374 self._output.flush() | 1376 self._output.flush() |
| OLD | NEW |