Skip to content

Commit

Permalink
Bug 1496889 [wpt PR 13403] - Minimize <video> dependency in `test_dri…
Browse files Browse the repository at this point in the history
…ver.bless` test, a=testonly

Automatic update from web-platform-testsMinimize <video> dependency in `test_driver.bless` test (#13403)

See diagnosis of Safari Technology Preview failure:
web-platform-tests/wpt#12621 (comment)

This test does not need to load any media resource or consider the state
of the returned promise.
--

wpt-commits: 21c33fe4cc3963faa4b38ab19e47660fa72c122f
wpt-pr: 13403
  • Loading branch information
foolip authored and moz-wptsync-bot committed Oct 12, 2018
1 parent d3c5205 commit df785cd
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions testing/web-platform/tests/infrastructure/testdriver/bless.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@
// activation concerns the interaction between iframe elements and their parent
// browsing contexts [1]. Because testdriver.js currently cannot operate within
// an iframe, the standard requirement cannot be used to verify the correctness
// of the `bless` method. Instead, rely on the non-standard restriction on
// unattended media playback. Browsers which do not implement such a
// restriction will pass this test spuriously.
// of the `bless` method. Instead, rely on the optional behavior of early exit
// and rejecting in `video.play()` if the media is not "allowed to play". [2]
// Browsers which don't implement this will pass this test spuriously.
//
// [1] https://html.spec.whatwg.org/multipage/origin.html#attr-iframe-sandbox-allow-top-navigation-by-user-activation
promise_test(() => {
// [2] https://html.spec.whatwg.org/multipage/media.html#allowed-to-play
promise_test(t => {
const video = document.createElement('video');
video.setAttribute('src', '/media/counting.ogv');
document.body.appendChild(video);
return test_driver.bless('start video playback', () => video.play())
t.add_cleanup(() => video.remove());
return test_driver.bless('start video playback', () => {
// `paused` changes before `play()` returns when "allowed to play", so the
// promise, if any, is ignored.
assert_true(video.paused);
const playPromise = video.play();
assert_false(video.paused);
if (playPromise) {
playPromise.catch(() => {});
}
});
}, 'user activation');

promise_test(() => {
Expand Down

0 comments on commit df785cd

Please sign in to comment.