• Dale Curtis's avatar
    Add layout tests exercising suspend/resume of src= media elements. · 99a9b48a
    Dale Curtis authored
    This is a reland of the following with an updated TestExpectations:
    https://chromium-review.googlesource.com/c/chromium/src/+/882283
    
    For the same reasons as the have metadata test is marked as pass
    or timeout, so to may the have future data test timeout if timing
    aligns just right to elide the resume call (not an issue in
    practice since the real suspend path elides the suspend call in
    this case)..
    
    -----------------------------
    
    Testing is accomplished by a couple new window.internals.* methods
    which allow modification and inspection of suspend state:
    - forceStaleStateForMediaElement(element)
    - isMediaElementSuspended(element)
    
    Unfortunately due to the async nature of suspend the method for
    testing suspend must be polled once a idle suspend is initiated via
    the forceStaleStateForMediaElement(). Test helper methods have been
    added to media/suspend-util.js to alleviate test cruft.
    
    forceStaleStateForMediaElement() does not actually force a suspend,
    it simply marks the element as stale. If an element is playing,
    seeking, or otherwise in a non-suspendable state, no suspend will
    occur. This is intentional to ensure tests cover our state machine
    as close to reality as possible.
    
    Unfortunately the only way to force given ready states for the
    media element is through throttled loading; this CL makes extensive
    use of throttled loading and adds a throttling limit to our layout
    test loader to avoid timeouts with slow initial rates. These tests
    were run with a --repeat-each=200 several times without flake, but
    I'll also watch the flakiness dashboard for these afterward.
    
    As a result of the above combined with the fact that we are not
    yet propagating play state to WMPI, we can reach a timeout state
    in the 'suspend after metadata' src= test. It's marked as pass
    and timeout in TestExpectations until the following lands:
    
    https://chromium-review.googlesource.com/c/chromium/src/+/876924
    
    This is part 1 of 2, the 2nd part will add MSE based variants of
    these tests. No new internals methods are expected though, just
    a appendBuffer() based mechanism for triggering ready states.
    
    BUG=694855, 756897
    TEST=it's all tests!
    TBR=mlamouri, peter, foolip
    
    Change-Id: Ie8f45d2d9572fd09c1943dc0674b25835527a1ab
    Reviewed-on: https://chromium-review.googlesource.com/895856Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#533534}
    99a9b48a
media-src-suspend-after-have-future-data.html 1.01 KB