Commit fa58328c authored by Benjamin Pastene's avatar Benjamin Pastene Committed by Commit Bot

android: Decrease timeout when dismissing dialog boxes, and take a ss.

Bug: 761806
Change-Id: I92f67e2ae97847d7484c53ba461d9f7f1a5b401a
Reviewed-on: https://chromium-review.googlesource.com/710231
Commit-Queue: Benjamin Pastene <bpastene@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509630}
parent 6010f6c4
...@@ -103,7 +103,7 @@ def DidPackageCrashOnDevice(package_name, device): ...@@ -103,7 +103,7 @@ def DidPackageCrashOnDevice(package_name, device):
# loop or we are failing to dismiss. # loop or we are failing to dismiss.
try: try:
for _ in xrange(10): for _ in xrange(10):
package = device.DismissCrashDialogIfNeeded() package = device.DismissCrashDialogIfNeeded(timeout=10, retries=1)
if not package: if not package:
return False return False
# Assume test package convention of ".test" suffix # Assume test package convention of ".test" suffix
...@@ -537,10 +537,16 @@ class LocalDeviceInstrumentationTestRun( ...@@ -537,10 +537,16 @@ class LocalDeviceInstrumentationTestRun(
for u in test_names.difference(results_names)) for u in test_names.difference(results_names))
# Update the result type if we detect a crash. # Update the result type if we detect a crash.
if DidPackageCrashOnDevice(self._test_instance.test_package, device): try:
for r in results: if DidPackageCrashOnDevice(self._test_instance.test_package, device):
if r.GetType() == base_test_result.ResultType.UNKNOWN: for r in results:
r.SetType(base_test_result.ResultType.CRASH) if r.GetType() == base_test_result.ResultType.UNKNOWN:
r.SetType(base_test_result.ResultType.CRASH)
except device_errors.CommandTimeoutError:
logging.warning('timed out when detecting/dismissing error dialogs')
# Attach screenshot to the test to help with debugging the dialog boxes.
self._SaveScreenshot(device, screenshot_device_file, test_display_name,
results, 'dialog_box_screenshot')
# Handle failures by: # Handle failures by:
# - optionally taking a screenshot # - optionally taking a screenshot
...@@ -550,7 +556,7 @@ class LocalDeviceInstrumentationTestRun( ...@@ -550,7 +556,7 @@ class LocalDeviceInstrumentationTestRun(
base_test_result.ResultType.SKIP) base_test_result.ResultType.SKIP)
for r in results): for r in results):
self._SaveScreenshot(device, screenshot_device_file, test_display_name, self._SaveScreenshot(device, screenshot_device_file, test_display_name,
results) results, 'post_test_screenshot')
logging.info('detected failure in %s. raw output:', test_display_name) logging.info('detected failure in %s. raw output:', test_display_name)
for l in output: for l in output:
...@@ -700,7 +706,8 @@ class LocalDeviceInstrumentationTestRun( ...@@ -700,7 +706,8 @@ class LocalDeviceInstrumentationTestRun(
with open(trace_host_file, 'a') as host_handle: with open(trace_host_file, 'a') as host_handle:
host_handle.write(java_trace_json) host_handle.write(java_trace_json)
def _SaveScreenshot(self, device, screenshot_device_file, test_name, results): def _SaveScreenshot(self, device, screenshot_device_file, test_name, results,
link_name):
screenshot_filename = '%s-%s.png' % ( screenshot_filename = '%s-%s.png' % (
test_name, time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime())) test_name, time.strftime('%Y%m%dT%H%M%S-UTC', time.gmtime()))
if device.FileExists(screenshot_device_file.name): if device.FileExists(screenshot_device_file.name):
...@@ -713,7 +720,7 @@ class LocalDeviceInstrumentationTestRun( ...@@ -713,7 +720,7 @@ class LocalDeviceInstrumentationTestRun(
finally: finally:
screenshot_device_file.close() screenshot_device_file.close()
for result in results: for result in results:
result.SetLink('post_test_screenshot', screenshot_host_file.Link()) result.SetLink(link_name, screenshot_host_file.Link())
def _ProcessRenderTestResults( def _ProcessRenderTestResults(
self, device, render_tests_device_output_dir, results): self, device, render_tests_device_output_dir, results):
......
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