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

Unified Diff: build/android/adb_reverse_forwarder.py

Issue 1132993004: [Android] Remove more references to and uses of AndroidCommands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_reverse_forwarder.py
diff --git a/build/android/adb_reverse_forwarder.py b/build/android/adb_reverse_forwarder.py
index 6cae0cf5c8375e0cec73b8ab603d34bf45729b04..3ce53595dae9f0657e0ef17f54a528305ba3464d 100755
--- a/build/android/adb_reverse_forwarder.py
+++ b/build/android/adb_reverse_forwarder.py
@@ -19,6 +19,7 @@ import time
from pylib import constants
from pylib import forwarder
from pylib.device import adb_wrapper
+from pylib.device import device_errors
from pylib.device import device_utils
from pylib.utils import run_tests_helper
@@ -56,16 +57,15 @@ def main(argv):
devices = device_utils.DeviceUtils.HealthyDevices()
if options.device:
- if options.device not in [str(d) for d in devices]:
- raise Exception('Error: %s not in attached devices %s' % (options.device,
- ','.join(devices)))
- devices = [options.device]
- else:
- if not devices:
- raise Exception('Error: no connected devices')
+ device = next((d for d in devices if d == options.device), None)
+ if not device:
+ raise device_errors.DeviceUnreachableError(options.device)
+ elif devices:
+ device = devices[0]
logging.info('No device specified. Defaulting to %s', devices[0])
+ else:
+ raise device_errors.NoDevicesError()
- device = devices[0]
constants.SetBuildType(options.build_type)
try:
forwarder.Forwarder.Map(port_pairs, device)
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/buildbot/bb_device_steps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698