Make networkState_during_progress.html deterministic (fixes servo/servo#17954)

This commit is contained in:
Anthony Ramine 2017-09-29 09:36:54 +02:00
parent abcf91e5c6
commit 53e2a4449a
3 changed files with 10 additions and 15 deletions

View file

@ -16,26 +16,22 @@
<script>
var ta = async_test("audioElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("progress", function() {
ta.step(function() {
assert_equals(a.networkState,
a.NETWORK_LOADING);
});
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);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
var tv = async_test("videoElement.networkState should be NETWORK_LOADING during progress event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("progress", function() {
tv.step(function() {
assert_equals(v.networkState,
v.NETWORK_LOADING);
});
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);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
</script>
</body>