| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 6 |
| 7 from telemetry.testing import serially_executed_browser_test_case | 7 from telemetry.testing import serially_executed_browser_test_case |
| 8 from telemetry.util import screenshot | 8 from telemetry.util import screenshot |
| 9 | 9 |
| 10 from gpu_tests import exception_formatter | 10 from gpu_tests import exception_formatter |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 # propagate to the next test iteration. | 79 # propagate to the next test iteration. |
| 80 self._RestartBrowser('unexpected test failure') | 80 self._RestartBrowser('unexpected test failure') |
| 81 raise | 81 raise |
| 82 elif expectation == 'fail': | 82 elif expectation == 'fail': |
| 83 msg = 'Expected exception while running %s' % test_name | 83 msg = 'Expected exception while running %s' % test_name |
| 84 exception_formatter.PrintFormattedException(msg=msg) | 84 exception_formatter.PrintFormattedException(msg=msg) |
| 85 # Even though this is a known failure, the browser might still | 85 # Even though this is a known failure, the browser might still |
| 86 # be in a bad state; for example, certain kinds of timeouts | 86 # be in a bad state; for example, certain kinds of timeouts |
| 87 # will affect the next test. Restart the browser to prevent | 87 # will affect the next test. Restart the browser to prevent |
| 88 # these kinds of failures propagating to the next test. | 88 # these kinds of failures propagating to the next test. |
| 89 self._RestartBrowser('expected test failure') | 89 # self._RestartBrowser('expected test failure') |
| 90 return | 90 return |
| 91 if expectation != 'flaky': | 91 if expectation != 'flaky': |
| 92 logging.warning( | 92 logging.warning( |
| 93 'Unknown expectation %s while handling exception for %s', | 93 'Unknown expectation %s while handling exception for %s', |
| 94 expectation, test_name) | 94 expectation, test_name) |
| 95 raise | 95 raise |
| 96 # Flaky tests are handled here. | 96 # Flaky tests are handled here. |
| 97 num_retries = expectations.GetFlakyRetriesForPage( | 97 num_retries = expectations.GetFlakyRetriesForPage( |
| 98 self.browser, temp_page) | 98 self.browser, temp_page) |
| 99 if not num_retries: | 99 if not num_retries: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 def setUp(self): | 155 def setUp(self): |
| 156 try: | 156 try: |
| 157 self.tab = self.browser.tabs[0] | 157 self.tab = self.browser.tabs[0] |
| 158 except Exception: | 158 except Exception: |
| 159 # restart the browser to make sure a failure in a test doesn't | 159 # restart the browser to make sure a failure in a test doesn't |
| 160 # propagate to the next test iteration. | 160 # propagate to the next test iteration. |
| 161 logging.exception("Failure during browser startup") | 161 logging.exception("Failure during browser startup") |
| 162 self._RestartBrowser('failure in setup') | 162 self._RestartBrowser('failure in setup') |
| 163 raise | 163 raise |
| OLD | NEW |