| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 def _RunGpuTest(self, url, test_name, *args): | 61 def _RunGpuTest(self, url, test_name, *args): |
| 62 temp_page = _EmulatedPage(url, test_name) | 62 temp_page = _EmulatedPage(url, test_name) |
| 63 expectations = self.__class__.GetExpectations() | 63 expectations = self.__class__.GetExpectations() |
| 64 expectation = expectations.GetExpectationForPage( | 64 expectation = expectations.GetExpectationForPage( |
| 65 self.browser, temp_page) | 65 self.browser, temp_page) |
| 66 if expectation == 'skip': | 66 if expectation == 'skip': |
| 67 # skipTest in Python's unittest harness raises an exception, so | 67 # skipTest in Python's unittest harness raises an exception, so |
| 68 # aborts the control flow here. | 68 # aborts the control flow here. |
| 69 self.skipTest('SKIPPING TEST due to test expectations') | 69 self.skipTest('SKIPPING TEST due to test expectations') |
| 70 try: | 70 try: |
| 71 # TODO(nednguyen): For some reason the arguments are getting wrapped |
| 72 # in another tuple sometimes (like in the WebGL extension tests). |
| 73 # Perhaps only if multiple arguments are yielded in the test |
| 74 # generator? |
| 75 if len(args) == 1 and isinstance(args[0], tuple): |
| 76 args = args[0] |
| 71 self.RunActualGpuTest(url, *args) | 77 self.RunActualGpuTest(url, *args) |
| 72 except Exception: | 78 except Exception: |
| 73 if expectation == 'pass': | 79 if expectation == 'pass': |
| 74 # This is not an expected exception or test failure, so print | 80 # This is not an expected exception or test failure, so print |
| 75 # the detail to the console. | 81 # the detail to the console. |
| 76 exception_formatter.PrintFormattedException() | 82 exception_formatter.PrintFormattedException() |
| 77 # This failure might have been caused by a browser or renderer | 83 # This failure might have been caused by a browser or renderer |
| 78 # crash, so restart the browser to make sure any state doesn't | 84 # crash, so restart the browser to make sure any state doesn't |
| 79 # propagate to the next test iteration. | 85 # propagate to the next test iteration. |
| 80 self._RestartBrowser('unexpected test failure') | 86 self._RestartBrowser('unexpected test failure') |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 160 |
| 155 def setUp(self): | 161 def setUp(self): |
| 156 try: | 162 try: |
| 157 self.tab = self.browser.tabs[0] | 163 self.tab = self.browser.tabs[0] |
| 158 except Exception: | 164 except Exception: |
| 159 # restart the browser to make sure a failure in a test doesn't | 165 # restart the browser to make sure a failure in a test doesn't |
| 160 # propagate to the next test iteration. | 166 # propagate to the next test iteration. |
| 161 logging.exception("Failure during browser startup") | 167 logging.exception("Failure during browser startup") |
| 162 self._RestartBrowser('failure in setup') | 168 self._RestartBrowser('failure in setup') |
| 163 raise | 169 raise |
| OLD | NEW |