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

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 445503004: Dismiss multiple error dialogs when running tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" 5 """Class for running instrumentation tests on a single device."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 duration_ms = int(time.time()) * 1000 - start_date_ms 386 duration_ms = int(time.time()) * 1000 - start_date_ms
387 status_code = raw_result.GetStatusCode() 387 status_code = raw_result.GetStatusCode()
388 if status_code: 388 if status_code:
389 if self.options.screenshot_failures: 389 if self.options.screenshot_failures:
390 self._TakeScreenshot(test) 390 self._TakeScreenshot(test)
391 log = raw_result.GetFailureReason() 391 log = raw_result.GetFailureReason()
392 if not log: 392 if not log:
393 log = 'No information.' 393 log = 'No information.'
394 result_type = base_test_result.ResultType.FAIL 394 result_type = base_test_result.ResultType.FAIL
395 package = self.device.old_interface.DismissCrashDialogIfNeeded() 395 package = self.device.old_interface.DismissCrashDialogIfNeeded()
396 # Assume test package convention of ".test" suffix 396 for _ in xrange(10):
Peter Beverloo 2014/08/05 14:03:43 10 is an arbitrary number I imagine? It would be g
aberent 2014/08/05 14:28:54 Already fixed. See patch set 3.
397 if package and package in self.test_pkg.GetPackageName(): 397 if not package:
398 result_type = base_test_result.ResultType.CRASH 398 break
399 # Assume test package convention of ".test" suffix
400 if package in self.test_pkg.GetPackageName():
401 result_type = base_test_result.ResultType.CRASH
402 break
403 package = self.device.old_interface.DismissCrashDialogIfNeeded()
399 result = test_result.InstrumentationTestResult( 404 result = test_result.InstrumentationTestResult(
400 test, result_type, start_date_ms, duration_ms, log=log) 405 test, result_type, start_date_ms, duration_ms, log=log)
401 else: 406 else:
402 result = test_result.InstrumentationTestResult( 407 result = test_result.InstrumentationTestResult(
403 test, base_test_result.ResultType.PASS, start_date_ms, duration_ms) 408 test, base_test_result.ResultType.PASS, start_date_ms, duration_ms)
404 results.AddResult(result) 409 results.AddResult(result)
405 # Catch exceptions thrown by StartInstrumentation(). 410 # Catch exceptions thrown by StartInstrumentation().
406 # See ../../third_party/android/testrunner/adb_interface.py 411 # See ../../third_party/android/testrunner/adb_interface.py
407 except (device_errors.CommandTimeoutError, 412 except (device_errors.CommandTimeoutError,
408 device_errors.DeviceUnreachableError, 413 device_errors.DeviceUnreachableError,
409 # TODO(jbudorick) Remove these once the underlying implementations 414 # TODO(jbudorick) Remove these once the underlying implementations
410 # for the above are switched or wrapped. 415 # for the above are switched or wrapped.
411 android_commands.errors.WaitForResponseTimedOutError, 416 android_commands.errors.WaitForResponseTimedOutError,
412 android_commands.errors.DeviceUnresponsiveError, 417 android_commands.errors.DeviceUnresponsiveError,
413 android_commands.errors.InstrumentationError), e: 418 android_commands.errors.InstrumentationError), e:
414 if start_date_ms: 419 if start_date_ms:
415 duration_ms = int(time.time()) * 1000 - start_date_ms 420 duration_ms = int(time.time()) * 1000 - start_date_ms
416 else: 421 else:
417 start_date_ms = int(time.time()) * 1000 422 start_date_ms = int(time.time()) * 1000
418 duration_ms = 0 423 duration_ms = 0
419 message = str(e) 424 message = str(e)
420 if not message: 425 if not message:
421 message = 'No information.' 426 message = 'No information.'
422 results.AddResult(test_result.InstrumentationTestResult( 427 results.AddResult(test_result.InstrumentationTestResult(
423 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, 428 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms,
424 log=message)) 429 log=message))
425 raw_result = None 430 raw_result = None
426 self.TestTeardown(test, raw_result) 431 self.TestTeardown(test, raw_result)
427 return (results, None if results.DidRunPass() else test) 432 return (results, None if results.DidRunPass() else test)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698