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

Unified Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 1092703002: [Android] More old_interface conversions in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perezju comments Created 5 years, 8 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/pylib/forwarder.py ('k') | build/android/pylib/monkey/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index ac3f5b177a8afa463902b528eacf839f59ff2760..1dc3ed4d7abbe31913275661d611195b871ff7b9 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -3,11 +3,14 @@
# found in the LICENSE file.
import logging
+import re
import time
from pylib import flag_changer
from pylib.base import base_test_result
from pylib.base import test_run
+from pylib.constants import keyevent
+from pylib.device import device_errors
from pylib.local.device import local_device_test_run
@@ -27,16 +30,36 @@ TIMEOUT_ANNOTATIONS = [
def DidPackageCrashOnDevice(package_name, device):
# Dismiss any error dialogs. Limit the number in case we have an error
# loop or we are failing to dismiss.
- for _ in xrange(10):
- package = device.old_interface.DismissCrashDialogIfNeeded()
- if not package:
- return False
- # Assume test package convention of ".test" suffix
- if package in package_name:
- return True
+ try:
+ for _ in xrange(10):
+ package = _DismissCrashDialog(device)
+ if not package:
+ return False
+ # Assume test package convention of ".test" suffix
+ if package in package_name:
+ return True
+ except device_errors.CommandFailedError:
+ logging.exception('Error while attempting to dismiss crash dialog.')
return False
+_CURRENT_FOCUS_CRASH_RE = re.compile(
+ r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}')
+
+
+def _DismissCrashDialog(device):
+ for l in device.RunShellCommand(
+ ['dumpsys', 'window', 'windows'], check_return=True):
+ m = re.match(_CURRENT_FOCUS_CRASH_RE, l)
+ if m:
+ device.SendKeyEvent(keyevent.KEYCODE_DPAD_RIGHT)
+ device.SendKeyEvent(keyevent.KEYCODE_DPAD_RIGHT)
+ device.SendKeyEvent(keyevent.KEYCODE_ENTER)
+ return m.group(2)
+
+ return None
+
+
class LocalDeviceInstrumentationTestRun(
local_device_test_run.LocalDeviceTestRun):
def __init__(self, env, test_instance):
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/monkey/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698