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

Unified Diff: build/android/test_runner.py

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.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/setup.gyp ('k') | build/apk_test.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/test_runner.py
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index c54ed28d324054eae3c5aee72aa1442d80bf1f36..b9d2a3f5c67379e6132f0ceef7c0b664b1a5deba 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -16,7 +16,6 @@ import sys
import threading
import unittest
-from pylib import android_commands
from pylib import constants
from pylib import forwarder
from pylib import ports
@@ -25,6 +24,8 @@ from pylib.base import environment_factory
from pylib.base import test_dispatcher
from pylib.base import test_instance_factory
from pylib.base import test_run_factory
+from pylib.device import device_errors
+from pylib.device import device_utils
from pylib.gtest import gtest_config
from pylib.gtest import setup as gtest_setup
from pylib.gtest import test_options as gtest_test_options
@@ -110,7 +111,7 @@ def ProcessCommonOptions(args):
if args.build_directory:
constants.SetBuildDirectory(args.build_directory)
if args.output_directory:
- constants.SetOutputDirectort(args.output_directory)
+ constants.SetOutputDirectory(args.output_directory)
if args.adb_path:
constants.SetAdbPath(args.adb_path)
# Some things such as Forwarder require ADB to be in the environment path.
@@ -867,18 +868,19 @@ def _GetAttachedDevices(test_device=None):
Returns:
A list of attached devices.
"""
- attached_devices = []
-
- attached_devices = android_commands.GetAttachedDevices()
+ attached_devices = device_utils.DeviceUtils.HealthyDevices()
if test_device:
- assert test_device in attached_devices, (
- 'Did not find device %s among attached device. Attached devices: %s'
- % (test_device, ', '.join(attached_devices)))
- attached_devices = [test_device]
-
- assert attached_devices, 'No devices attached.'
+ test_device = [d for d in attached_devices if d == test_device]
+ if not test_device:
+ raise device_errors.DeviceUnreachableError(
+ 'Did not find device %s among attached device. Attached devices: %s'
+ % (test_device, ', '.join(attached_devices)))
+ return test_device
- return sorted(attached_devices)
+ else:
+ if not attached_devices:
+ raise device_errors.NoDevicesError()
+ return sorted(attached_devices)
def RunTestsCommand(args, parser):
« no previous file with comments | « build/android/setup.gyp ('k') | build/apk_test.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698