| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 TIMEOUT_ANNOTATIONS = [ | 28 TIMEOUT_ANNOTATIONS = [ |
| 29 ('Manual', 10 * 60 * 60), | 29 ('Manual', 10 * 60 * 60), |
| 30 ('IntegrationTest', 30 * 60), | 30 ('IntegrationTest', 30 * 60), |
| 31 ('External', 10 * 60), | 31 ('External', 10 * 60), |
| 32 ('EnormousTest', 10 * 60), | 32 ('EnormousTest', 10 * 60), |
| 33 ('LargeTest', 5 * 60), | 33 ('LargeTest', 5 * 60), |
| 34 ('MediumTest', 3 * 60), | 34 ('MediumTest', 3 * 60), |
| 35 ('SmallTest', 1 * 60), | 35 ('SmallTest', 1 * 60), |
| 36 ] | 36 ] |
| 37 | 37 |
| 38 LOGCAT_FILTERS = ['*:e', 'chromium:v', 'cr_*:v'] | |
| 39 | 38 |
| 40 # TODO(jbudorick): Make this private once the instrumentation test_runner is | 39 # TODO(jbudorick): Make this private once the instrumentation test_runner is |
| 41 # deprecated. | 40 # deprecated. |
| 42 def DidPackageCrashOnDevice(package_name, device): | 41 def DidPackageCrashOnDevice(package_name, device): |
| 43 # Dismiss any error dialogs. Limit the number in case we have an error | 42 # Dismiss any error dialogs. Limit the number in case we have an error |
| 44 # loop or we are failing to dismiss. | 43 # loop or we are failing to dismiss. |
| 45 try: | 44 try: |
| 46 for _ in xrange(10): | 45 for _ in xrange(10): |
| 47 package = device.DismissCrashDialogIfNeeded() | 46 package = device.DismissCrashDialogIfNeeded() |
| 48 if not package: | 47 if not package: |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], | 284 ['log', '-p', 'i', '-t', _TAG, 'START %s' % test_name], |
| 286 check_return=True) | 285 check_return=True) |
| 287 time_ms = lambda: int(time.time() * 1e3) | 286 time_ms = lambda: int(time.time() * 1e3) |
| 288 start_ms = time_ms() | 287 start_ms = time_ms() |
| 289 | 288 |
| 290 stream_name = 'logcat_%s_%s_%s' % ( | 289 stream_name = 'logcat_%s_%s_%s' % ( |
| 291 test_name.replace('#', '.'), | 290 test_name.replace('#', '.'), |
| 292 time.strftime('%Y%m%dT%H%M%S', time.localtime()), | 291 time.strftime('%Y%m%dT%H%M%S', time.localtime()), |
| 293 device.serial) | 292 device.serial) |
| 294 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( | 293 logmon = logdog_logcat_monitor.LogdogLogcatMonitor( |
| 295 device.adb, stream_name, filter_specs=LOGCAT_FILTERS) | 294 device.adb, stream_name) |
| 296 | |
| 297 with contextlib_ext.Optional( | 295 with contextlib_ext.Optional( |
| 298 logmon, self._test_instance.should_save_logcat): | 296 logmon, self._test_instance.should_save_logcat): |
| 299 with contextlib_ext.Optional( | 297 with contextlib_ext.Optional( |
| 300 trace_event.trace(test_name), | 298 trace_event.trace(test_name), |
| 301 self._env.trace_output): | 299 self._env.trace_output): |
| 302 output = device.StartInstrumentation( | 300 output = device.StartInstrumentation( |
| 303 target, raw=True, extras=extras, timeout=timeout, retries=0) | 301 target, raw=True, extras=extras, timeout=timeout, retries=0) |
| 304 logcat_url = logmon.GetLogcatURL() | 302 logcat_url = logmon.GetLogcatURL() |
| 305 finally: | 303 finally: |
| 306 device.RunShellCommand( | 304 device.RunShellCommand( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 timeout = v | 425 timeout = v |
| 428 break | 426 break |
| 429 else: | 427 else: |
| 430 logging.warning('Using default 1 minute timeout for %s', test_name) | 428 logging.warning('Using default 1 minute timeout for %s', test_name) |
| 431 timeout = 60 | 429 timeout = 60 |
| 432 | 430 |
| 433 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) | 431 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) |
| 434 | 432 |
| 435 return timeout | 433 return timeout |
| 436 | 434 |
| OLD | NEW |