Index: webrtc/examples/androidtests/video_quality_loopback_test.py |
diff --git a/webrtc/examples/androidtests/video_quality_loopback_test.py b/webrtc/examples/androidtests/video_quality_loopback_test.py |
index e8c4381f1f94fff230e8acc26c1ab92b59cbe363..aa0d8a92b781299a7d9b8a9888790cbf72ce0b75 100755 |
--- a/webrtc/examples/androidtests/video_quality_loopback_test.py |
+++ b/webrtc/examples/androidtests/video_quality_loopback_test.py |
@@ -19,6 +19,7 @@ It assumes you have a Android device plugged in. |
""" |
import argparse |
+import json |
import logging |
import os |
import shutil |
@@ -31,6 +32,9 @@ import time |
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, |
os.pardir)) |
+BAD_DEVICES_JSON = os.path.join(SRC_DIR, |
+ os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
+ 'bad_devices.json') |
class Error(Exception): |
@@ -109,10 +113,19 @@ def main(): |
_RunCommand([sys.executable, setup_apprtc_script, temp_dir]) |
# Select an Android device in case multiple are connected |
+ try: |
+ with open(BAD_DEVICES_JSON) as bad_devices_file: |
+ bad_devices = json.load(bad_devices_file) |
+ except IOError: |
+ if os.environ.get('CHROME_HEADLESS'): |
+ logging.warning('Cannot read %r', BAD_DEVICES_JSON) |
+ bad_devices = {} |
+ |
for line in _RunCommandWithOutput([adb_path, 'devices']).splitlines(): |
if line.endswith('\tdevice'): |
android_device = line.split('\t')[0] |
- break |
+ if android_device not in bad_devices: |
+ break |
else: |
raise VideoQualityTestError('Cannot find any connected Android device.') |