Properly use test() in networkState_during_progress.html

This commit is contained in:
Anthony Ramine 2017-09-29 16:51:55 +02:00
parent 2b64c3e6c0
commit 9f71ac9155
2 changed files with 23 additions and 19 deletions

View file

@ -14,25 +14,29 @@
</video>
<div id="log"></div>
<script>
var ta = async_test("audioElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("error", ta.unreached_func());
a.addEventListener("progress", ta.step_func(function() {
assert_equals(a.networkState, a.NETWORK_LOADING);
ta.done();
a.pause();
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
test(function() {
var ta = async_test("audioElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("error", ta.unreached_func());
a.addEventListener("progress", ta.step_func(function() {
assert_equals(a.networkState, a.NETWORK_LOADING);
ta.done();
a.pause();
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - networkState during progress");
var tv = async_test("videoElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("error", tv.unreached_func());
v.addEventListener("progress", tv.step_func(function() {
assert_equals(v.networkState, v.NETWORK_LOADING);
tv.done();
v.pause();
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
test(function() {
var tv = async_test("videoElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("error", tv.unreached_func());
v.addEventListener("progress", tv.step_func(function() {
assert_equals(v.networkState, v.NETWORK_LOADING);
tv.done();
v.pause();
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - networkState during progress");
</script>
</body>
</html>