Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 a variety of device interactions based on adb. | 5 """Provides a variety of device interactions based on adb. |
| 6 | 6 |
| 7 Eventually, this will be based on adb_wrapper. | 7 Eventually, this will be based on adb_wrapper. |
| 8 """ | 8 """ |
| 9 # pylint: disable=unused-argument | 9 # pylint: disable=unused-argument |
| 10 | 10 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 other: The instance of DeviceUtils to compare to. | 209 other: The instance of DeviceUtils to compare to. |
| 210 Returns: | 210 Returns: |
| 211 Whether |self| is less than |other|. | 211 Whether |self| is less than |other|. |
| 212 """ | 212 """ |
| 213 return self.adb.GetDeviceSerial() < other.adb.GetDeviceSerial() | 213 return self.adb.GetDeviceSerial() < other.adb.GetDeviceSerial() |
| 214 | 214 |
| 215 def __str__(self): | 215 def __str__(self): |
| 216 """Returns the device serial.""" | 216 """Returns the device serial.""" |
| 217 return self.adb.GetDeviceSerial() | 217 return self.adb.GetDeviceSerial() |
| 218 | 218 |
| 219 @property | |
| 220 def default_timeout(self): | |
|
jbudorick
2015/08/23 02:01:28
I don't mind the getter, though I don't really see
agrieve
2015/08/26 00:22:40
Done.
| |
| 221 return self._default_timeout | |
| 222 | |
| 223 @default_timeout.setter | |
| 224 def default_timeout(self, value): | |
|
jbudorick
2015/08/23 02:01:28
I don't like the setter. I don't think we should a
agrieve
2015/08/26 00:22:40
Done.
| |
| 225 self._default_timeout = value | |
| 226 | |
| 227 @property | |
| 228 def default_retries(self): | |
| 229 return self._default_retries | |
| 230 | |
| 231 @default_retries.setter | |
| 232 def default_retries(self, value): | |
| 233 self._default_retries = value | |
| 234 | |
| 219 @decorators.WithTimeoutAndRetriesFromInstance() | 235 @decorators.WithTimeoutAndRetriesFromInstance() |
| 220 def IsOnline(self, timeout=None, retries=None): | 236 def IsOnline(self, timeout=None, retries=None): |
| 221 """Checks whether the device is online. | 237 """Checks whether the device is online. |
| 222 | 238 |
| 223 Args: | 239 Args: |
| 224 timeout: timeout in seconds | 240 timeout: timeout in seconds |
| 225 retries: number of retries | 241 retries: number of retries |
| 226 | 242 |
| 227 Returns: | 243 Returns: |
| 228 True if the device is online, False otherwise. | 244 True if the device is online, False otherwise. |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1882 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() | 1898 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
| 1883 if not blacklisted(adb)] | 1899 if not blacklisted(adb)] |
| 1884 | 1900 |
| 1885 @decorators.WithTimeoutAndRetriesFromInstance() | 1901 @decorators.WithTimeoutAndRetriesFromInstance() |
| 1886 def RestartAdbd(self, timeout=None, retries=None): | 1902 def RestartAdbd(self, timeout=None, retries=None): |
| 1887 logging.info('Restarting adbd on device.') | 1903 logging.info('Restarting adbd on device.') |
| 1888 with device_temp_file.DeviceTempFile(self.adb, suffix='.sh') as script: | 1904 with device_temp_file.DeviceTempFile(self.adb, suffix='.sh') as script: |
| 1889 self.WriteFile(script.name, _RESTART_ADBD_SCRIPT) | 1905 self.WriteFile(script.name, _RESTART_ADBD_SCRIPT) |
| 1890 self.RunShellCommand(['source', script.name], as_root=True) | 1906 self.RunShellCommand(['source', script.name], as_root=True) |
| 1891 self.adb.WaitForDevice() | 1907 self.adb.WaitForDevice() |
| OLD | NEW |