Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: build/android/pylib/device/device_utils.py

Issue 724413003: Migrate device_utils.RestartServer to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 403f235eabdc6877bc79e225ecdf9a83ee08b693..d52a74b985825da44277b1b8ee1541d57622616b 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -53,7 +53,20 @@ def RestartServer():
Raises:
CommandFailedError if we fail to kill or restart the server.
"""
- pylib.android_commands.AndroidCommands().RestartAdbServer()
+ def adb_killed():
+ status, _ = cmd_helper.GetCmdStatusAndOutput(['pgrep', 'adb'])
+ return status != 0 # pgrep didn't find adb, kill-server succeeded
+
+ def adb_started():
+ status, _ = cmd_helper.GetCmdStatusAndOutput(['pgrep', 'adb'])
+ return status == 0 # pgrep found adb, start-server succeeded
+
+ adb_wrapper.AdbWrapper.KillServer()
+ if not timeout_retry.WaitFor(adb_killed, wait_period=1, max_tries=5):
+ raise device_errors.CommandFailedError('Failed to kill adb server')
+ adb_wrapper.AdbWrapper.StartServer()
+ if not timeout_retry.WaitFor(adb_started, wait_period=1, max_tries=5):
+ raise device_errors.CommandFailedError('Failed to start adb server')
class DeviceUtils(object):

Powered by Google App Engine
This is Rietveld 408576698