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=W0613 | 9 # pylint: disable=W0613 |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 Raises: | 309 Raises: |
310 CommandTimeoutError on timeout. | 310 CommandTimeoutError on timeout. |
311 DeviceUnreachableError on missing device. | 311 DeviceUnreachableError on missing device. |
312 """ | 312 """ |
313 def device_offline(): | 313 def device_offline(): |
314 return not self.IsOnline() | 314 return not self.IsOnline() |
315 | 315 |
316 self.adb.Reboot() | 316 self.adb.Reboot() |
317 self._cache = {} | 317 self._cache = {} |
318 timeout_retry.WaitFor(device_offline, wait_period=1, max_tries=5) | 318 timeout_retry.WaitFor(device_offline, wait_period=1) |
319 if block: | 319 if block: |
320 self.WaitUntilFullyBooted() | 320 self.WaitUntilFullyBooted() |
321 | 321 |
322 INSTALL_DEFAULT_TIMEOUT = 4 * _DEFAULT_TIMEOUT | 322 INSTALL_DEFAULT_TIMEOUT = 4 * _DEFAULT_TIMEOUT |
323 INSTALL_DEFAULT_RETRIES = _DEFAULT_RETRIES | 323 INSTALL_DEFAULT_RETRIES = _DEFAULT_RETRIES |
324 | 324 |
325 @decorators.WithTimeoutAndRetriesDefaults( | 325 @decorators.WithTimeoutAndRetriesDefaults( |
326 INSTALL_DEFAULT_TIMEOUT, | 326 INSTALL_DEFAULT_TIMEOUT, |
327 INSTALL_DEFAULT_RETRIES) | 327 INSTALL_DEFAULT_RETRIES) |
328 def Install(self, apk_path, reinstall=False, timeout=None, retries=None): | 328 def Install(self, apk_path, reinstall=False, timeout=None, retries=None): |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 Returns: | 1166 Returns: |
1167 A Parallelizer operating over |devices|. | 1167 A Parallelizer operating over |devices|. |
1168 """ | 1168 """ |
1169 if not devices or len(devices) == 0: | 1169 if not devices or len(devices) == 0: |
1170 devices = pylib.android_commands.GetAttachedDevices() | 1170 devices = pylib.android_commands.GetAttachedDevices() |
1171 parallelizer_type = (parallelizer.Parallelizer if async | 1171 parallelizer_type = (parallelizer.Parallelizer if async |
1172 else parallelizer.SyncParallelizer) | 1172 else parallelizer.SyncParallelizer) |
1173 return parallelizer_type([ | 1173 return parallelizer_type([ |
1174 d if isinstance(d, DeviceUtils) else DeviceUtils(d) | 1174 d if isinstance(d, DeviceUtils) else DeviceUtils(d) |
1175 for d in devices]) | 1175 for d in devices]) |
OLD | NEW |