Properly fail in event_loadedmetadata.html

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

View file

@ -17,20 +17,22 @@
test(function() {
var t = async_test("setting src attribute on autoplay audio should trigger loadedmetadata event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("loadedmetadata", function() {
a.addEventListener("error", t.unreached_func());
a.addEventListener("loadedmetadata", t.step_func(function() {
t.done();
a.pause();
});
}));
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - loadedmetadata");
test(function() {
var t = async_test("setting src attribute on autoplay video should trigger loadedmetadata event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("loadedmetadata", function() {
v.addEventListener("error", t.unreached_func());
v.addEventListener("loadedmetadata", t.step_func(function() {
t.done();
v.pause();
});
}));
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - loadedmetadata");
</script>