content/test/gpu/gpu_tests/trace_integration_test.py
def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator,
                                        other_args):
    """Verifies video frames are promoted to overlays when supported."""
    os_name = self.browser.platform.GetOSName()
    assert os_name and os_name.lower() == 'win'

    other_args = other_args or {}
    expected = self._GetVideoExpectations(other_args)

    presentation_mode_history = []
    for event in event_iterator:
      if event.category != category:
        continue
      if event.name != _GET_STATISTICS_EVENT_NAME:
        continue
      if expected.no_overlay:
        self.fail('Expected no overlay got %s' % _GET_STATISTICS_EVENT_NAME)
      detected_presentation_mode = event.args.get('CompositionMode', None)
      if detected_presentation_mode is None:
        self.fail('PresentationMode is missing from event %s' %
                  _GET_STATISTICS_EVENT_NAME)
      presentation_mode_history.append(detected_presentation_mode)

    if expected.no_overlay:
      return

    valid_entry_found = False
    for index in range(len(presentation_mode_history)):
      mode = presentation_mode_history[index]
      if (mode == _SWAP_CHAIN_PRESENTATION_MODE_NONE
          or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED):
        # Be more tolerant to avoid test flakiness
        continue
      if (TraceIntegrationTest._SwapChainPresentationModeToStr(mode) !=
          expected.presentation_mode):
        if index >= len(presentation_mode_history) // 2:
          # Be more tolerant for the first half frames in non-overlay mode.
          self.fail('SwapChain presentation mode mismatch, expected %s got %s' %
                    (expected.presentation_mode,
                     TraceIntegrationTest._SwapChainPresentationModeListToStr(
                         presentation_mode_history)))
      valid_entry_found = True
    if not valid_entry_found:
      self.fail(
          'No valid frame statistics being collected: %s' % TraceIntegrationTest
          ._SwapChainPresentationModeListToStr(presentation_mode_history))
Verifies video frames are promoted to overlays when supported.
Verifies video frames are promoted to overlays when supported.
Verifies video frames are promoted to overlays when supported .
def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator,
                                        other_args):
    os_name = self.browser.platform.GetOSName()
    assert os_name and os_name.lower() == 'win'
    other_args = other_args or {}
    expected = self._GetVideoExpectations(other_args)
    presentation_mode_history = []
    for event in event_iterator:
      if event.category != category:
        continue
      if event.name != _GET_STATISTICS_EVENT_NAME:
        continue
      if expected.no_overlay:
        self.fail('Expected no overlay got %s' % _GET_STATISTICS_EVENT_NAME)
      detected_presentation_mode = event.args.get('CompositionMode', None)
      if detected_presentation_mode is None:
        self.fail('PresentationMode is missing from event %s' %
                  _GET_STATISTICS_EVENT_NAME)
      presentation_mode_history.append(detected_presentation_mode)
    if expected.no_overlay:
      return
    valid_entry_found = False
    for index in range(len(presentation_mode_history)):
      mode = presentation_mode_history[index]
      if (mode == _SWAP_CHAIN_PRESENTATION_MODE_NONE
          or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED):
        continue
      if (TraceIntegrationTest._SwapChainPresentationModeToStr(mode) !=
          expected.presentation_mode):
        if index >= len(presentation_mode_history) // 2:
          self.fail('SwapChain presentation mode mismatch, expected %s got %s' %
                    (expected.presentation_mode,
                     TraceIntegrationTest._SwapChainPresentationModeListToStr(
                         presentation_mode_history)))
      valid_entry_found = True
    if not valid_entry_found:
      self.fail(
          'No valid frame statistics being collected: %s' % TraceIntegrationTest
          ._SwapChainPresentationModeListToStr(presentation_mode_history))
def _EvaluateSuccess_CheckOverlayMode ( self , category , event_iterator , other_args ) : os_name = self . browser . platform . GetOSName ( ) assert os_name and os_name . lower ( ) == 'win' other_args = other_args or { } expected = self . _GetVideoExpectations ( other_args ) presentation_mode_history = [ ] for event in event_iterator : if event . category != category : continue if event . name != _GET_STATISTICS_EVENT_NAME : continue if expected . no_overlay : self . fail ( 'Expected no overlay got %s' % _GET_STATISTICS_EVENT_NAME ) detected_presentation_mode = event . args . get ( 'CompositionMode' , None ) if detected_presentation_mode is None : self . fail ( 'PresentationMode is missing from event %s' % _GET_STATISTICS_EVENT_NAME ) presentation_mode_history . append ( detected_presentation_mode ) if expected . no_overlay : return valid_entry_found = False for index in range ( len ( presentation_mode_history ) ) : mode = presentation_mode_history [ index ] if ( mode == _SWAP_CHAIN_PRESENTATION_MODE_NONE or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED ) : continue if ( TraceIntegrationTest . _SwapChainPresentationModeToStr ( mode ) != expected . presentation_mode ) : if index >= len ( presentation_mode_history ) // 2 : self . fail ( 'SwapChain presentation mode mismatch, expected %s got %s' % ( expected . presentation_mode , TraceIntegrationTest . _SwapChainPresentationModeListToStr ( presentation_mode_history ) ) ) valid_entry_found = True if not valid_entry_found : self . fail ( 'No valid frame statistics being collected: %s' % TraceIntegrationTest . _SwapChainPresentationModeListToStr ( presentation_mode_history ) )
Verifies video frames are promoted to overlays when supported.
Verifies video frames are promoted to overlays when supported .
"""Verifies video frames are promoted to overlays when supported.""" # Be more tolerant to avoid test flakiness # Be more tolerant for the first half frames in non-overlay mode.
self
category
event_iterator
other_args