Make event_order_loadstart_progress.htm deterministic (fixes servo/servo#18289)

This commit is contained in:
Anthony Ramine 2017-09-29 09:32:26 +02:00
parent b489d0c159
commit abcf91e5c6
3 changed files with 18 additions and 21 deletions

View file

@ -569381,7 +569381,7 @@
"testharness" "testharness"
], ],
"html/semantics/embedded-content/media-elements/event_order_loadstart_progress.html": [ "html/semantics/embedded-content/media-elements/event_order_loadstart_progress.html": [
"013746f8434b90d53724e7cd924f8b430cdc52b3", "1a22967566471d711f6b82c8e59ebd6b8681b004",
"testharness" "testharness"
], ],
"html/semantics/embedded-content/media-elements/event_pause.html": [ "html/semantics/embedded-content/media-elements/event_pause.html": [

View file

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

View file

@ -14,39 +14,37 @@
</video> </video>
<div id="log"></div> <div id="log"></div>
<script> <script>
test(function() { (function() {
var t = async_test("setting src attribute on autoplay audio should trigger loadstart then progress event", {timeout:5000}); var t = async_test("setting src attribute on autoplay audio should trigger loadstart then progress event", {timeout:5000});
var a = document.getElementById("a"); var a = document.getElementById("a");
var found_loadstart = false; var found_loadstart = false;
a.addEventListener("loadstart", function() { a.addEventListener("error", t.unreached_func());
a.addEventListener("loadstart", t.step_func(function() {
found_loadstart = true; found_loadstart = true;
}); }));
a.addEventListener("progress", function() { a.addEventListener("progress", t.step_func(function() {
t.step(function() { assert_true(found_loadstart);
assert_true(found_loadstart);
});
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 - loadstart, then progress"); })();
test(function() { (function() {
var t = async_test("setting src attribute on autoplay video should trigger loadstart then progress event", {timeout:5000}); var t = async_test("setting src attribute on autoplay video should trigger loadstart then progress event", {timeout:5000});
var v = document.getElementById("v"); var v = document.getElementById("v");
var found_loadstart = false; var found_loadstart = false;
v.addEventListener("loadstart", function() { v.addEventListener("error", t.unreached_func());
v.addEventListener("loadstart", t.step_func(function() {
found_loadstart = true; found_loadstart = true;
}); }));
v.addEventListener("progress", function() { v.addEventListener("progress", t.step_func(function() {
t.step(function() { assert_true(found_loadstart);
assert_true(found_loadstart);
});
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 - loadstart, then progress"); })();
</script> </script>
</body> </body>
</html> </html>