Commit 10b69072 authored by aberent@chromium.org's avatar aberent@chromium.org

Dismiss multiple error dialogs when running tests

Previously the code would dismiss at most one error dialog before or
after running a test. This now loops until no error dialogs are shown.

This should reduce the instance of INJECTION_EVENT failures, but won't
cure them completely.

BUG=399870

Review URL: https://codereview.chromium.org/445503004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287592 0039d316-1c4b-4281-b951-d872f2087c98
parent 16510cd5
......@@ -392,10 +392,16 @@ class TestRunner(base_test_runner.BaseTestRunner):
if not log:
log = 'No information.'
result_type = base_test_result.ResultType.FAIL
package = self.device.old_interface.DismissCrashDialogIfNeeded()
# Assume test package convention of ".test" suffix
if package and package in self.test_pkg.GetPackageName():
result_type = base_test_result.ResultType.CRASH
# 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 = self.device.old_interface.DismissCrashDialogIfNeeded()
if not package:
break
# Assume test package convention of ".test" suffix
if package in self.test_pkg.GetPackageName():
result_type = base_test_result.ResultType.CRASH
break
result = test_result.InstrumentationTestResult(
test, result_type, start_date_ms, duration_ms, log=log)
else:
......
......@@ -274,7 +274,11 @@ class AndroidBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
# If we have no existing tabs start with a blank page since default
# startup with the NTP can lead to race conditions with Telemetry
url = 'about:blank'
self._adb.device().old_interface.DismissCrashDialogIfNeeded()
# Dismiss any error dialogs. Limit the number in case we have an error loop
# or we are failing to dismiss.
for _ in xrange(10):
if not self._adb.device().old_interface.DismissCrashDialogIfNeeded():
break
self._adb.device().StartActivity(
intent.Intent(package=self._backend_settings.package,
activity=self._backend_settings.activity,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment