Chromium Code Reviews| Index: build/android/pylib/device/device_utils.py |
| diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py |
| index c8a5c3a48124107fe9142489c6cf999e4d143eb4..7b39d5d3f9f3e1a36ce79da39df44165ff8cef38 100644 |
| --- a/build/android/pylib/device/device_utils.py |
| +++ b/build/android/pylib/device/device_utils.py |
| @@ -7,15 +7,54 @@ Provides a variety of device interactions based on adb. |
| Eventually, this will be based on adb_wrapper. |
| """ |
| +# pylint: disable=W0613 |
| import pylib.android_commands |
| from pylib.device import adb_wrapper |
| +from pylib.device import decorators |
| -def GetAVDs(): |
| +_DEFAULT_TIMEOUT = 30 |
| +_DEFAULT_RETRIES = 3 |
| + |
| + |
| +_WithTimeoutAndRetries = decorators.WithTimeoutAndRetries |
|
craigdh
2014/05/13 15:46:24
This additional level of indirection is confusing.
bulach
2014/05/13 16:14:40
gargh! :D
ok, rant #271 :)
these "translations" ju
craigdh
2014/05/13 16:18:18
I'm 100% with Marcus on this one.
|
| +_WithTimeoutAndRetriesDefaults = decorators.WithTimeoutAndRetriesDefaults |
| +_WithTimeoutAndRetriesFromInstance = ( |
| + decorators.WithTimeoutAndRetriesFromInstance('_default_timeout', |
| + '_default_retries')) |
| + |
| + |
| +@_WithTimeoutAndRetriesDefaults(_DEFAULT_TIMEOUT, _DEFAULT_RETRIES) |
| +def GetAVDs(timeout=None, retries=None): |
|
bulach
2014/05/13 16:14:40
is there any client passing these args in any sens
|
| + """ Returns a list of Android Virtual Devices. |
| + |
| + Args: |
| + timeout: The length of time to wait before giving up on either killing or |
| + restarting the server. |
| + retries: The number of times to retry either killing or restarting the |
| + server. |
| + Returns: |
| + A list containing the configured AVDs. |
| + """ |
| return pylib.android_commands.GetAVDs() |
| +@_WithTimeoutAndRetriesDefaults(_DEFAULT_TIMEOUT, _DEFAULT_RETRIES) |
| +def RestartServer(timeout=None, retries=None): |
| + """ Restarts the adb server. |
| + |
| + Args: |
| + timeout: The length of time to wait before giving up on either killing or |
| + restarting the server. |
| + retries: The number of times to retry either killing or restarting the |
| + server. |
| + Raises: |
| + CommandFailedError if we fail to kill or restart the server. |
| + """ |
| + pylib.android_commands.AndroidCommands().RestartAdbServer() |
| + |
| + |
| class DeviceUtils(object): |
| def __init__(self, device): |