def StartBrowser(cls):
   # We still need to retry the browser's launch even though
   # desktop_browser_finder does so too, because it wasn't possible
   # to push the fetch of the first tab into the lower retry loop
   # without breaking Telemetry's unit tests, and that hook is used
   # to implement the gpu_integration_test_unittests.
   for x in range(0, 3):
     try:
       super(GpuIntegrationTest, cls).StartBrowser()
       cls.tab = cls.browser.tabs[0]
       return
     except Exception:
       logging.warning('Browser start failed (attempt %d of 3)', (x + 1))
       # If we are on the last try and there is an exception take a screenshot
       # to try and capture more about the browser failure and raise
       if x == 2:
         url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage(
           cls.platform)
         if url is not None:
           logging.info("GpuIntegrationTest screenshot of browser failure " +
             "located at " + url)
         else:
           logging.warning("GpuIntegrationTest unable to take screenshot")
         raise
       # Otherwise, stop the browser to make sure it's in an
       # acceptable state to try restarting it.
       if cls.browser:
         cls.StopBrowser()
 def StartBrowser(cls):
     # We still need to retry the browser's launch even though
     # desktop_browser_finder does so too, because it wasn't possible
     # to push the fetch of the first tab into the lower retry loop
     # without breaking Telemetry's unit tests, and that hook is used
     # to implement the gpu_integration_test_unittests.
     for x in range(1, _START_BROWSER_RETRIES +
                    1):  # Index from 1 instead of 0.
         try:
             super(GpuIntegrationTest, cls).StartBrowser()
             cls.tab = cls.browser.tabs[0]
             return
         except Exception:
             logging.exception(
                 'Browser start failed (attempt %d of %d). Backtrace:', x,
                 _START_BROWSER_RETRIES)
             # If we are on the last try and there is an exception take a screenshot
             # to try and capture more about the browser failure and raise
             if x == _START_BROWSER_RETRIES:
                 url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage(
                     cls.platform)
                 if url is not None:
                     logging.info(
                         "GpuIntegrationTest screenshot of browser failure "
                         + "located at " + url)
                 else:
                     logging.warning(
                         "GpuIntegrationTest unable to take screenshot.")
             # Stop the browser to make sure it's in an
             # acceptable state to try restarting it.
             if cls.browser:
                 cls.StopBrowser()
     # Re-raise the last exception thrown. Only happens if all the retries
     # fail.
     raise
 def StartBrowser(cls):
     for x in range(0, 3):
         try:
             restart = 'Starting browser, attempt %d of 3' % (x + 1)
             logging.warning(restart)
             super(GpuIntegrationTest, cls).StartBrowser()
             cls.tab = cls.browser.tabs[0]
             logging.warning('Started browser successfully.')
             return
         except Exception:
             # If we are on the last try and there is an exception take a screenshot
             # to try and capture more about the browser failure and raise
             if x == 2:
                 url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage(
                     cls.platform)
                 if url is not None:
                     logging.info(
                         "GpuIntegrationTest screenshot of browser failure "
                         + "located at " + url)
                 else:
                     logging.warning(
                         "GpuIntegrationTest unable to take screenshot")
                 raise
             # Otherwise, stop the browser to make sure it's in an
             # acceptable state to try restarting it.
             if cls.browser:
                 cls.StopBrowser()
Beispiel #4
0
 def StartBrowser(cls):
     for x in range(0, 3):
         try:
             restart = 'Starting browser, attempt %d of 3' % (x + 1)
             logging.warning(restart)
             super(GpuIntegrationTest, cls).StartBrowser()
             return
         except Exception:
             # If we are on the last try and there is an exception take a screenshot
             # to try and capture more about the browser failure and raise
             if x == 2:
                 url = screenshot.TryCaptureScreenShotAndUploadToCloudStorage(
                     cls.platform)
                 if url is not None:
                     logging.info(
                         "GpuIntegrationTest screenshot of browser failure "
                         + "located at " + url)
                 else:
                     logging.warning(
                         "GpuIntegrationTest unable to take screenshot")
                 raise