content/test/gpu/gpu_tests/pixel_integration_test.py
def _RunSkiaGoldBasedPixelTest(self, page):
    """Captures and compares a test image using Skia Gold.

    Raises an Exception if the comparison fails.

    Args:
      page: the GPU PixelTestPage object for the test.
    """
    tab = self.tab
    # Actually run the test and capture the screenshot.
    if not tab.EvaluateJavaScript('domAutomationController._succeeded'):
      self.fail('page indicated test failure')
    # Special case some tests on Fuchsia that need to grab the entire contents
    # in the screenshot instead of just the visible portion due to small screen
    # sizes.
    if (PixelIntegrationTest.browser.platform.GetOSName() == 'fuchsia'
        and page.name in pixel_test_pages.PROBLEMATIC_FUCHSIA_TESTS):
      screenshot = tab.FullScreenshot(5)
    else:
      screenshot = tab.Screenshot(5)
    if screenshot is None:
      self.fail('Could not capture screenshot')
    dpr = tab.EvaluateJavaScript('window.devicePixelRatio')
    if page.test_rect:
      # When actually clamping the value, it's possible we'll catch the
      # scrollbar, so account for its width in the clamp.
      end_x = min(int(page.test_rect[2] * dpr),
                  image_util.Width(screenshot) - SCROLLBAR_WIDTH)
      end_y = min(int(page.test_rect[3] * dpr), image_util.Height(screenshot))
      screenshot = image_util.Crop(screenshot, int(page.test_rect[0] * dpr),
                                   int(page.test_rect[1] * dpr), end_x, end_y)

    image_name = self._UrlToImageName(page.name)
    self._UploadTestResultToSkiaGold(image_name, screenshot, page)
Captures and compares a test image using Skia Gold.

    Raises an Exception if the comparison fails.

    Args:
      page: the GPU PixelTestPage object for the test.
    
Captures and compares a test image using Skia Gold.
Raises an Exception if the comparison fails.
Captures and compares a test image using Skia Gold . Raises an Exception if the comparison fails .
def _RunSkiaGoldBasedPixelTest(self, page):
    tab = self.tab
    if not tab.EvaluateJavaScript('domAutomationController._succeeded'):
      self.fail('page indicated test failure')
    if (PixelIntegrationTest.browser.platform.GetOSName() == 'fuchsia'
        and page.name in pixel_test_pages.PROBLEMATIC_FUCHSIA_TESTS):
      screenshot = tab.FullScreenshot(5)
    else:
      screenshot = tab.Screenshot(5)
    if screenshot is None:
      self.fail('Could not capture screenshot')
    dpr = tab.EvaluateJavaScript('window.devicePixelRatio')
    if page.test_rect:
      end_x = min(int(page.test_rect[2] * dpr),
                  image_util.Width(screenshot) - SCROLLBAR_WIDTH)
      end_y = min(int(page.test_rect[3] * dpr), image_util.Height(screenshot))
      screenshot = image_util.Crop(screenshot, int(page.test_rect[0] * dpr),
                                   int(page.test_rect[1] * dpr), end_x, end_y)
    image_name = self._UrlToImageName(page.name)
    self._UploadTestResultToSkiaGold(image_name, screenshot, page)
def _RunSkiaGoldBasedPixelTest ( self , page ) : tab = self . tab if not tab . EvaluateJavaScript ( 'domAutomationController._succeeded' ) : self . fail ( 'page indicated test failure' ) if ( PixelIntegrationTest . browser . platform . GetOSName ( ) == 'fuchsia' and page . name in pixel_test_pages . PROBLEMATIC_FUCHSIA_TESTS ) : screenshot = tab . FullScreenshot ( 5 ) else : screenshot = tab . Screenshot ( 5 ) if screenshot is None : self . fail ( 'Could not capture screenshot' ) dpr = tab . EvaluateJavaScript ( 'window.devicePixelRatio' ) if page . test_rect : end_x = min ( int ( page . test_rect [ 2 ] * dpr ) , image_util . Width ( screenshot ) - SCROLLBAR_WIDTH ) end_y = min ( int ( page . test_rect [ 3 ] * dpr ) , image_util . Height ( screenshot ) ) screenshot = image_util . Crop ( screenshot , int ( page . test_rect [ 0 ] * dpr ) , int ( page . test_rect [ 1 ] * dpr ) , end_x , end_y ) image_name = self . _UrlToImageName ( page . name ) self . _UploadTestResultToSkiaGold ( image_name , screenshot , page )
Captures and compares a test image using Skia Gold.
Captures and compares a test image using Skia Gold .
"""Captures and compares a test image using Skia Gold.

    Raises an Exception if the comparison fails.

    Args:
      page: the GPU PixelTestPage object for the test.
    """ # Actually run the test and capture the screenshot. # Special case some tests on Fuchsia that need to grab the entire contents # in the screenshot instead of just the visible portion due to small screen # sizes. # When actually clamping the value, it's possible we'll catch the # scrollbar, so account for its width in the clamp.
self
page
the GPU PixelTestPage object for the test.
the GPU PixelTestPage object for the test .