| 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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 build_id = self.RunShellCommand('getprop ro.build.id')[0] | 832 build_id = self.RunShellCommand('getprop ro.build.id')[0] |
| 833 assert build_id | 833 assert build_id |
| 834 return build_id | 834 return build_id |
| 835 | 835 |
| 836 def GetBuildType(self): | 836 def GetBuildType(self): |
| 837 """Returns the build type of the system (e.g. eng).""" | 837 """Returns the build type of the system (e.g. eng).""" |
| 838 build_type = self.RunShellCommand('getprop ro.build.type')[0] | 838 build_type = self.RunShellCommand('getprop ro.build.type')[0] |
| 839 assert build_type | 839 assert build_type |
| 840 return build_type | 840 return build_type |
| 841 | 841 |
| 842 def GetProductModel(self): |
| 843 """Returns the namve of the product model (e.g. "Galaxy Nexus") """ |
| 844 model = self.RunShellCommand('getprop ro.product.model')[0] |
| 845 assert model |
| 846 return model |
| 847 |
| 842 def StartMonitoringLogcat(self, clear=True, logfile=None, filters=None): | 848 def StartMonitoringLogcat(self, clear=True, logfile=None, filters=None): |
| 843 """Starts monitoring the output of logcat, for use with WaitForLogMatch. | 849 """Starts monitoring the output of logcat, for use with WaitForLogMatch. |
| 844 | 850 |
| 845 Args: | 851 Args: |
| 846 clear: If True the existing logcat output will be cleared, to avoiding | 852 clear: If True the existing logcat output will be cleared, to avoiding |
| 847 matching historical output lurking in the log. | 853 matching historical output lurking in the log. |
| 848 filters: A list of logcat filters to be used. | 854 filters: A list of logcat filters to be used. |
| 849 """ | 855 """ |
| 850 if clear: | 856 if clear: |
| 851 self.RunShellCommand('logcat -c') | 857 self.RunShellCommand('logcat -c') |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 """ | 1226 """ |
| 1221 def __init__(self, output): | 1227 def __init__(self, output): |
| 1222 self._output = output | 1228 self._output = output |
| 1223 | 1229 |
| 1224 def write(self, data): | 1230 def write(self, data): |
| 1225 data = data.replace('\r\r\n', '\n') | 1231 data = data.replace('\r\r\n', '\n') |
| 1226 self._output.write(data) | 1232 self._output.write(data) |
| 1227 | 1233 |
| 1228 def flush(self): | 1234 def flush(self): |
| 1229 self._output.flush() | 1235 self._output.flush() |
| OLD | NEW |