Chromium Code Reviews| Index: content/test/gpu/gpu_tests/gpu_integration_test.py |
| diff --git a/content/test/gpu/gpu_tests/gpu_integration_test.py b/content/test/gpu/gpu_tests/gpu_integration_test.py |
| index 811df39d77946fd262d9cddba0501fbd963f25fc..aaafbfc87a5eceb11a2bdc2437a49f8c7d47daa9 100644 |
| --- a/content/test/gpu/gpu_tests/gpu_integration_test.py |
| +++ b/content/test/gpu/gpu_tests/gpu_integration_test.py |
| @@ -19,22 +19,37 @@ class _EmulatedPage(object): |
| self.name = name |
| + |
| class GpuIntegrationTest( |
| serially_executed_browser_test_case.SeriallyExecutedBrowserTestCase): |
| _cached_expectations = None |
| + def __init__(self, methodName): |
| + super(GpuIntegrationTest, self).__init__(methodName) |
| + self._num_retries = 0 |
| + |
| @classmethod |
| def GenerateTestCases__RunGpuTest(cls, options): |
| for test_name, url, args in cls.GenerateGpuTests(options): |
| yield test_name, (url, test_name, args) |
| def _RestartBrowser(self, reason): |
| - logging.warning('Restarting browser due to ' + reason) |
| - self.StopBrowser() |
| - self.SetBrowserOptions(self._finder_options) |
| - self.StartBrowser() |
| - self.tab = self.browser.tabs[0] |
| + try: |
| + restart_attempt = ('Restarting browser %d time due to ' |
| + % (self._num_retries + 1)) |
| + logging.warning(restart_attempt + reason) |
| + self.StopBrowser() |
| + self.SetBrowserOptions(self._finder_options) |
| + self.StartBrowser() |
| + self.tab = self.browser.tabs[0] |
| + except Exception: |
| + if self._num_retries < 3: |
| + self._num_retries += 1 |
| + # Attempt to resart the browser 3 times on failure |
| + self._RestartBrowser(reason) |
|
nednguyen
2016/07/25 15:13:31
Can you do a for loop instead of recursion?
eyaich
2016/07/26 13:15:33
Done.
|
| + else: |
| + raise |
| def _RunGpuTest(self, url, test_name, args): |
| temp_page = _EmulatedPage(url, test_name) |