Properly fail in event_order_canplay_canplaythrough.html

This commit is contained in:
Anthony Ramine 2017-09-29 14:47:57 +02:00
parent 59c56de103
commit 026130094d
3 changed files with 14 additions and 17 deletions

View file

@ -569369,7 +569369,7 @@
"testharness" "testharness"
], ],
"html/semantics/embedded-content/media-elements/event_order_canplay_canplaythrough.html": [ "html/semantics/embedded-content/media-elements/event_order_canplay_canplaythrough.html": [
"70e74de8fe3eab2c775489364faa1eab832ef14d", "a9a9889a42a2fb654bc09d543320fc5adaf82157",
"testharness" "testharness"
], ],
"html/semantics/embedded-content/media-elements/event_order_canplay_playing.html": [ "html/semantics/embedded-content/media-elements/event_order_canplay_playing.html": [

View file

@ -1,6 +1,5 @@
[event_order_canplay_canplaythrough.html] [event_order_canplay_canplaythrough.html]
type: testharness type: testharness
expected: TIMEOUT
[setting src attribute on autoplay audio should trigger canplay then canplaythrough event] [setting src attribute on autoplay audio should trigger canplay then canplaythrough event]
expected: NOTRUN expected: FAIL

View file

@ -18,16 +18,15 @@ test(function() {
var t = async_test("setting src attribute on autoplay audio should trigger canplay then canplaythrough event", {timeout:5000}); var t = async_test("setting src attribute on autoplay audio should trigger canplay then canplaythrough event", {timeout:5000});
var a = document.getElementById("a"); var a = document.getElementById("a");
var found_canplay = false; var found_canplay = false;
a.addEventListener("canplay", function() { a.addEventListener("error", t.unreached_func());
a.addEventListener("canplay", t.step_func(function() {
found_canplay = true; found_canplay = true;
}); }));
a.addEventListener("canplaythrough", function() { a.addEventListener("canplaythrough", t.step_func(function() {
t.step(function() {
assert_true(found_canplay); assert_true(found_canplay);
});
t.done(); t.done();
a.pause(); a.pause();
}, false); }), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random(); a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - canplay, then canplaythrough"); }, "audio events - canplay, then canplaythrough");
@ -35,16 +34,15 @@ test(function() {
var t = async_test("setting src attribute on autoplay video should trigger canplay then canplaythrough event", {timeout:5000}); var t = async_test("setting src attribute on autoplay video should trigger canplay then canplaythrough event", {timeout:5000});
var v = document.getElementById("v"); var v = document.getElementById("v");
var found_canplay = false; var found_canplay = false;
v.addEventListener("canplay", function() { v.addEventListener("error", t.unreached_func());
v.addEventListener("canplay", t.step_func(function() {
found_canplay = true; found_canplay = true;
}); }));
v.addEventListener("canplaythrough", function() { v.addEventListener("canplaythrough", t.step_func(function() {
t.step(function() {
assert_true(found_canplay); assert_true(found_canplay);
});
t.done(); t.done();
v.pause(); v.pause();
}, false); }), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random(); v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - canplay, then canplaythrough"); }, "video events - canplay, then canplaythrough");
</script> </script>