mirror of
https://github.com/servo/servo.git
synced 2025-09-20 11:50:09 +01:00
Assert play promise rejected caused by pause()
This commit is contained in:
parent
445c1d0706
commit
0284afc51a
4 changed files with 29 additions and 25 deletions
|
@ -612764,7 +612764,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/event_pause_noautoplay.html": [
|
"html/semantics/embedded-content/media-elements/event_pause_noautoplay.html": [
|
||||||
"55482348387de77def1c1be10d3dbe174fa3cb58",
|
"8b985a65fe372346370075e3e9e992548e9b8abb",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/event_play.html": [
|
"html/semantics/embedded-content/media-elements/event_play.html": [
|
||||||
|
@ -612772,7 +612772,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/event_play_noautoplay.html": [
|
"html/semantics/embedded-content/media-elements/event_play_noautoplay.html": [
|
||||||
"67285a95abdca01fd7bc6dc95f4ad8c94b7f8536",
|
"94fcb837d04c0f82da1660d95465b53bc8a052a6",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/event_playing.html": [
|
"html/semantics/embedded-content/media-elements/event_playing.html": [
|
||||||
|
@ -613172,7 +613172,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/paused_true_during_pause.html": [
|
"html/semantics/embedded-content/media-elements/paused_true_during_pause.html": [
|
||||||
"6c4eb7c0c09fd2f048c96eff66d58b05ab3e4952",
|
"2a9335bd4e6026ff1c029fb140c3b146474e3523",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document.html": [
|
"html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document.html": [
|
||||||
|
|
|
@ -14,26 +14,28 @@
|
||||||
</video>
|
</video>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
promise_test(function(t) {
|
||||||
var t = async_test("calling play() then pause() on non-autoplay audio should trigger pause event", {timeout:5000});
|
var async_t = async_test("calling play() then pause() on non-autoplay audio should trigger pause event", {timeout:5000});
|
||||||
var a = document.getElementById("a");
|
var a = document.getElementById("a");
|
||||||
a.addEventListener("pause", function() {
|
a.addEventListener("pause", function() {
|
||||||
t.done();
|
async_t.done();
|
||||||
}, false);
|
}, false);
|
||||||
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
||||||
a.play();
|
var play_promise = a.play();
|
||||||
a.pause();
|
a.pause();
|
||||||
|
return promise_rejects(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
|
||||||
}, "audio events - pause");
|
}, "audio events - pause");
|
||||||
|
|
||||||
test(function() {
|
promise_test(function(t) {
|
||||||
var t = async_test("calling play() then pause() on non-autoplay video should trigger pause event", {timeout:5000});
|
var async_t = async_test("calling play() then pause() on non-autoplay video should trigger pause event", {timeout:5000});
|
||||||
var v = document.getElementById("v");
|
var v = document.getElementById("v");
|
||||||
v.addEventListener("pause", function() {
|
v.addEventListener("pause", function() {
|
||||||
t.done();
|
async_t.done();
|
||||||
}, false);
|
}, false);
|
||||||
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
||||||
v.play();
|
var play_promise = v.play()
|
||||||
v.pause();
|
v.pause();
|
||||||
|
return promise_rejects(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
|
||||||
}, "video events - pause");
|
}, "video events - pause");
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -14,26 +14,26 @@
|
||||||
</video>
|
</video>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<script>
|
<script>
|
||||||
test(function() {
|
promise_test(function(t) {
|
||||||
var t = async_test("calling play() on audio should trigger play event", {timeout:5000});
|
var async_t = async_test("calling play() on audio should trigger play event", {timeout:5000});
|
||||||
var a = document.getElementById("a");
|
var a = document.getElementById("a");
|
||||||
a.addEventListener("play", function() {
|
a.addEventListener("play", async_t.step_func(function() {
|
||||||
t.done();
|
|
||||||
a.pause();
|
a.pause();
|
||||||
}, false);
|
async_t.done();
|
||||||
|
}), false);
|
||||||
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
||||||
a.play();
|
return promise_rejects(t, "AbortError", a.play(), "pause() should reject all pending play Promises");
|
||||||
}, "audio events - play");
|
}, "audio events - play");
|
||||||
|
|
||||||
test(function() {
|
promise_test(function(t) {
|
||||||
var t = async_test("calling play() on video should trigger play event", {timeout:5000});
|
var async_t = async_test("calling play() on video should trigger play event", {timeout:5000});
|
||||||
var v = document.getElementById("v");
|
var v = document.getElementById("v");
|
||||||
v.addEventListener("play", function() {
|
v.addEventListener("play", async_t.step_func(function() {
|
||||||
t.done();
|
|
||||||
v.pause();
|
v.pause();
|
||||||
}, false);
|
async_t.done();
|
||||||
|
}), false);
|
||||||
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
||||||
v.play();
|
return promise_rejects(t, "AbortError", v.play(), "pause() should reject all pending play Promises");
|
||||||
}, "video events - play");
|
}, "video events - play");
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -21,10 +21,11 @@ test(function() {
|
||||||
t.step(function() {
|
t.step(function() {
|
||||||
assert_true(a.paused);
|
assert_true(a.paused);
|
||||||
});
|
});
|
||||||
|
|
||||||
t.done();
|
t.done();
|
||||||
}, false);
|
}, false);
|
||||||
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
|
||||||
a.play();
|
a.play().catch(() => {});
|
||||||
a.pause();
|
a.pause();
|
||||||
}, "audio events - paused property");
|
}, "audio events - paused property");
|
||||||
|
|
||||||
|
@ -35,10 +36,11 @@ test(function() {
|
||||||
t.step(function() {
|
t.step(function() {
|
||||||
assert_true(v.paused);
|
assert_true(v.paused);
|
||||||
});
|
});
|
||||||
|
|
||||||
t.done();
|
t.done();
|
||||||
}, false);
|
}, false);
|
||||||
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
|
||||||
v.play();
|
v.play().catch(() => {});
|
||||||
v.pause();
|
v.pause();
|
||||||
}, "video events - paused property");
|
}, "video events - paused property");
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue