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

Side by Side Diff: content/test/gpu/gpu_tests/gpu_integration_test.py

Issue 2643023004: Fetch the first tab inside the browser startup retry loop. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/gpu_integration_test_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 for test_name, url, args in cls.GenerateGpuTests(options): 21 for test_name, url, args in cls.GenerateGpuTests(options):
22 yield test_name, (url, test_name, args) 22 yield test_name, (url, test_name, args)
23 23
24 @classmethod 24 @classmethod
25 def StartBrowser(cls): 25 def StartBrowser(cls):
26 for x in range(0, 3): 26 for x in range(0, 3):
27 try: 27 try:
28 restart = 'Starting browser, attempt %d of 3' % (x + 1) 28 restart = 'Starting browser, attempt %d of 3' % (x + 1)
29 logging.warning(restart) 29 logging.warning(restart)
30 super(GpuIntegrationTest, cls).StartBrowser() 30 super(GpuIntegrationTest, cls).StartBrowser()
31 cls.tab = cls.browser.tabs[0]
32 logging.warning('Started browser successfully.')
31 return 33 return
32 except Exception: 34 except Exception:
33 # If we are on the last try and there is an exception take a screenshot 35 # If we are on the last try and there is an exception take a screenshot
34 # to try and capture more about the browser failure and raise 36 # to try and capture more about the browser failure and raise
35 if x == 2: 37 if x == 2:
36 url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage( 38 url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage(
37 cls.platform) 39 cls.platform)
38 if url is not None: 40 if url is not None:
39 logging.info("GpuIntegrationTest screenshot of browser failure " + 41 logging.info("GpuIntegrationTest screenshot of browser failure " +
40 "located at " + url) 42 "located at " + url)
41 else: 43 else:
42 logging.warning("GpuIntegrationTest unable to take screenshot") 44 logging.warning("GpuIntegrationTest unable to take screenshot")
43 raise 45 raise
46 # Otherwise, stop the browser to make sure it's in an
47 # acceptable state to try restarting it.
48 if cls.browser:
49 cls.StopBrowser()
44 50
45 @classmethod 51 @classmethod
46 def _RestartBrowser(cls, reason): 52 def _RestartBrowser(cls, reason):
47 logging.warning('Restarting browser due to '+ reason) 53 logging.warning('Restarting browser due to '+ reason)
48 cls.StopBrowser() 54 cls.StopBrowser()
49 cls.SetBrowserOptions(cls._finder_options) 55 cls.SetBrowserOptions(cls._finder_options)
50 cls.StartBrowser() 56 cls.StartBrowser()
51 cls.tab = cls.browser.tabs[0]
52 57
53 def _RunGpuTest(self, url, test_name, *args): 58 def _RunGpuTest(self, url, test_name, *args):
54 expectations = self.__class__.GetExpectations() 59 expectations = self.__class__.GetExpectations()
55 expectation = expectations.GetExpectationForTest( 60 expectation = expectations.GetExpectationForTest(
56 self.browser, url, test_name) 61 self.browser, url, test_name)
57 if expectation == 'skip': 62 if expectation == 'skip':
58 # skipTest in Python's unittest harness raises an exception, so 63 # skipTest in Python's unittest harness raises an exception, so
59 # aborts the control flow here. 64 # aborts the control flow here.
60 self.skipTest('SKIPPING TEST due to test expectations') 65 self.skipTest('SKIPPING TEST due to test expectations')
61 try: 66 try:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 cls.tab = cls.browser.tabs[0] 187 cls.tab = cls.browser.tabs[0]
183 except Exception: 188 except Exception:
184 # restart the browser to make sure a failure in a test doesn't 189 # restart the browser to make sure a failure in a test doesn't
185 # propagate to the next test iteration. 190 # propagate to the next test iteration.
186 logging.exception("Failure during browser startup") 191 logging.exception("Failure during browser startup")
187 cls._RestartBrowser('failure in setup') 192 cls._RestartBrowser('failure in setup')
188 raise 193 raise
189 194
190 def setUp(self): 195 def setUp(self):
191 self._EnsureTabIsAvailable() 196 self._EnsureTabIsAvailable()
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/gpu_integration_test_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698