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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 logging.warning("GpuIntegrationTest unable to take screenshot") | 51 logging.warning("GpuIntegrationTest unable to take screenshot") |
52 raise | 52 raise |
53 | 53 |
54 def _RestartBrowser(self, reason): | 54 def _RestartBrowser(self, reason): |
55 logging.warning('Restarting browser due to '+ reason) | 55 logging.warning('Restarting browser due to '+ reason) |
56 self.StopBrowser() | 56 self.StopBrowser() |
57 self.SetBrowserOptions(self._finder_options) | 57 self.SetBrowserOptions(self._finder_options) |
58 self.StartBrowser() | 58 self.StartBrowser() |
59 self.tab = self.browser.tabs[0] | 59 self.tab = self.browser.tabs[0] |
60 | 60 |
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 self.RunActualGpuTest(url, *args) | 71 self.RunActualGpuTest(url, *args) |
(...skipping 82 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 |