| 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 93e364eb426599cdcd32abc69fc1ce9122f3f96d..70de2d73b308fa44fc842b93b4f41986743f3052 100644
|
| --- a/build/android/pylib/device/device_utils.py
|
| +++ b/build/android/pylib/device/device_utils.py
|
| @@ -7,12 +7,15 @@ Provides a variety of device interactions based on adb.
|
|
|
| Eventually, this will be based on adb_wrapper.
|
| """
|
| +# pylint: disable=W0613
|
|
|
| import multiprocessing
|
| import os
|
| import sys
|
| +
|
| import pylib.android_commands
|
| from pylib.device import adb_wrapper
|
| +from pylib.device import decorators
|
|
|
| CHROME_SRC_DIR = os.path.abspath(
|
| os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
|
| @@ -20,8 +23,8 @@ sys.path.append(os.path.join(
|
| CHROME_SRC_DIR, 'third_party', 'android_testrunner'))
|
| import errors
|
|
|
| -def GetAVDs():
|
| - return pylib.android_commands.GetAVDs()
|
| +_DEFAULT_TIMEOUT = 30
|
| +_DEFAULT_RETRIES = 3
|
|
|
|
|
| # multiprocessing map_async requires a top-level function for pickle library.
|
| @@ -51,6 +54,38 @@ def RebootDevices():
|
| print 'Reboots complete.'
|
|
|
|
|
| +@decorators.WithTimeoutAndRetriesDefaults(
|
| + _DEFAULT_TIMEOUT, _DEFAULT_RETRIES)
|
| +def GetAVDs(timeout=None, retries=None):
|
| + """ 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()
|
| +
|
| +
|
| +@decorators.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):
|
|
|