blob: c99ad97e60b31ec07a7a2d3c4577a5cd3261f810 [file] [log] [blame]
Test that a user gesture is preserved across XHR and setTimeout.
Run!
** gesture -> XHR -> timeout -> XHR -> window.open: should fail because XHR only propagates user gesture for media
sending XHR, delay = 100
EVENT(load): readyState = 4
setting timeout, delay = 100
sending XHR, delay = 100
EVENT(load): readyState = 4
EXPECTED (window.open("about:blank") == 'null') OK
** gesture -> timeout -> XHR -> timeout -> window.open: should succeed
setting timeout, delay = 100
sending XHR, delay = 100
EVENT(load): readyState = 4
setting timeout, delay = 100
EXPECTED (window.open("about:blank") != 'null') OK
** gesture -> timeout -> XHR -> timeout -> video playback: should succeed
EVENT(canplaythrough)
setting timeout, delay = 100
sending XHR, delay = 100
EVENT(load): readyState = 4
setting timeout, delay = 100
RUN(shouldResolve(mediaElement.play()).then(testComplete, testComplete))
Promise resolved OK
** gesture -> XHR -> timeout -> XHR -> video playback: should succeed
EVENT(canplaythrough)
sending XHR, delay = 100
EVENT(load): readyState = 4
setting timeout, delay = 100
sending XHR, delay = 100
EVENT(load): readyState = 4
RUN(shouldResolve(mediaElement.play()).then(testComplete, testComplete))
Promise resolved OK
** NO gesture -> XHR -> timeout -> video playback: should fail
EVENT(canplaythrough)
sending XHR, delay = 100
EVENT(load): readyState = 4
setting timeout, delay = 100
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** gesture -> "long" XHR -> video playback: should fail
EVENT(canplaythrough)
sending XHR, delay = 300
EVENT(load): readyState = 4
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** gesture -> fetch -> window.open: should fail because Fetch only propagates user gesture for media
fetching, delay = 100
FETCH(resolved): status = 200
EXPECTED (window.open("about:blank") == 'null') OK
** gesture -> fetch -> video playback: should succeed
EVENT(canplaythrough)
fetching, delay = 100
FETCH(resolved): status = 200
RUN(shouldResolve(mediaElement.play()).then(testComplete, testComplete))
Promise resolved OK
** gesture -> "long" Fetch -> video playback: should fail
EVENT(canplaythrough)
fetching, delay = 300
FETCH(resolved): status = 200
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** no gesture -> fetch -> video playback: should fail
EVENT(canplaythrough)
fetching, delay = 100
FETCH(resolved): status = 200
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** gesture -> fetch -> blob -> window.open: should fail because Fetch only propagates user gesture for media
fetching blob, delay = 100
FETCH(resolved): status = 200
FETCH(response resolved)
EXPECTED (window.open("about:blank") == 'null') OK
** gesture -> fetch -> blob -> video playback: should succeed
EVENT(canplaythrough)
fetching blob, delay = 100
FETCH(resolved): status = 200
FETCH(response resolved)
RUN(shouldResolve(mediaElement.play()).then(testComplete, testComplete))
Promise resolved OK
** gesture -> fetch -> "long" blob -> video playback: should fail
EVENT(canplaythrough)
fetching blob, delay = 300
FETCH(resolved): status = 200
FETCH(response resolved)
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** no gesture -> fetch -> blob -> video playback: should fail
EVENT(canplaythrough)
fetching blob, delay = 100
FETCH(resolved): status = 200
FETCH(response resolved)
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** no gesture -> promise -> video playback: should fail
EVENT(canplaythrough)
promise
PROMISE(resolved)
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** gesture -> promise -> video playback: should fail because promise only propagates user gesture propagated through Fetch
EVENT(canplaythrough)
promise
PROMISE(resolved)
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
** gesture -> fetch -> promise -> video playback: should succeed
EVENT(canplaythrough)
fetch then promise
FETCH(resolved): status = 200
PROMISE(resolved)
RUN(shouldResolve(mediaElement.play()).then(testComplete, testComplete))
Promise resolved OK
** gesture -> fetch -> crypto -> video playback: should fail since the user gesture will not be propagated through other API even though it returns promises
EVENT(canplaythrough)
fetch then crypto
FETCH(resolved): status = 200
CRYPTO(key generated)
RUN(shouldReject(mediaElement.play()).then(testComplete, testComplete))
Promise rejected correctly OK
END OF TEST