| 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 | 1008 |
| 1009 def GetProductModel(self): | 1009 def GetProductModel(self): |
| 1010 """Returns the name of the product model (e.g. "Galaxy Nexus") """ | 1010 """Returns the name of the product model (e.g. "Galaxy Nexus") """ |
| 1011 model = self.RunShellCommand('getprop ro.product.model')[0] | 1011 model = self.RunShellCommand('getprop ro.product.model')[0] |
| 1012 assert model | 1012 assert model |
| 1013 return model | 1013 return model |
| 1014 | 1014 |
| 1015 def GetWifiIP(self): | 1015 def GetWifiIP(self): |
| 1016 """Returns the wifi IP on the device.""" | 1016 """Returns the wifi IP on the device.""" |
| 1017 wifi_ip = self.RunShellCommand('getprop dhcp.wlan0.ipaddress')[0] | 1017 wifi_ip = self.RunShellCommand('getprop dhcp.wlan0.ipaddress')[0] |
| 1018 assert wifi_ip | 1018 # Do not assert here. Devices (e.g. emulators) may not have a WifiIP. |
| 1019 return wifi_ip | 1019 return wifi_ip |
| 1020 | 1020 |
| 1021 def GetSubscriberInfo(self): | 1021 def GetSubscriberInfo(self): |
| 1022 """Returns the device subscriber info (e.g. GSM and device ID) as string.""" | 1022 """Returns the device subscriber info (e.g. GSM and device ID) as string.""" |
| 1023 iphone_sub = self.RunShellCommand('dumpsys iphonesubinfo') | 1023 iphone_sub = self.RunShellCommand('dumpsys iphonesubinfo') |
| 1024 assert iphone_sub | 1024 assert iphone_sub |
| 1025 return '\n'.join(iphone_sub) | 1025 return '\n'.join(iphone_sub) |
| 1026 | 1026 |
| 1027 def GetBatteryInfo(self): | 1027 def GetBatteryInfo(self): |
| 1028 """Returns the device battery info (e.g. status, level, etc) as string.""" | 1028 """Returns the device battery info (e.g. status, level, etc) as string.""" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 """ | 1469 """ |
| 1470 def __init__(self, output): | 1470 def __init__(self, output): |
| 1471 self._output = output | 1471 self._output = output |
| 1472 | 1472 |
| 1473 def write(self, data): | 1473 def write(self, data): |
| 1474 data = data.replace('\r\r\n', '\n') | 1474 data = data.replace('\r\r\n', '\n') |
| 1475 self._output.write(data) | 1475 self._output.write(data) |
| 1476 | 1476 |
| 1477 def flush(self): | 1477 def flush(self): |
| 1478 self._output.flush() | 1478 self._output.flush() |
| OLD | NEW |