Auto merge of #18678 - servo:DETERMINISTIC-ALL-THE-THINGS, r=jdm

Improve the media tests

This avoids a bunch of timeouts and make running the tests from `/html/semantics/embedded-content/media-elements/` in 25 seconds instead of 47 locally on my machine.
This commit is contained in:
bors-servo 2017-09-29 12:23:52 -05:00 committed by GitHub
commit b2ee8d9ee8
42 changed files with 205 additions and 236 deletions

View file

@ -569353,7 +569353,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_loadedmetadata.html": [
"a0fa9cca891fcdf066409b225daff6d09bf53601",
"138177c8cebf75e7fa54e6def5f90cfd094af5d6",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_loadedmetadata_noautoplay.html": [
@ -569369,23 +569369,23 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_order_canplay_canplaythrough.html": [
"70e74de8fe3eab2c775489364faa1eab832ef14d",
"a9a9889a42a2fb654bc09d543320fc5adaf82157",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_order_canplay_playing.html": [
"f9a6c488442573dfc0d06acd1f6944d8cb2d585e",
"7d2254f2362cc90fd7f7573d5c7b7a9bfd29187e",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_order_loadedmetadata_loadeddata.html": [
"1f9a9ee27d7cedb3c7f128276770334780afb523",
"47080891dfd6b2f011fdbb6423e2635ac84eecc4",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_order_loadstart_progress.html": [
"1a22967566471d711f6b82c8e59ebd6b8681b004",
"4041b86a67a3b2759856bd878af62fb88b07a129",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_pause.html": [
"d1d4945f75e8febfd1ed29947700da38d9adcda4",
"f7ab9fc551958133aa80482828a59c82ffbfaa7a",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_pause_noautoplay.html": [
@ -569393,7 +569393,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_play.html": [
"5ab77070444e804dbecad5260dd71ddaa4dba1cb",
"aa4636d5968a489ad21b5bef88185ccf343afb01",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_play_noautoplay.html": [
@ -569401,7 +569401,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_playing.html": [
"3cef57701c8c8591046bce55713beb0c007e775f",
"e204b0a66e6c51e8ad9e088df567423bc2e81c86",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_playing_noautoplay.html": [
@ -569409,11 +569409,11 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_progress.html": [
"ded3566e885ca7d1837f102ebbc6a120708799e4",
"c5d307c9d5b3283f72c88f1496e9ccd6526db285",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_progress_noautoplay.html": [
"7274516f1fa0685e1f919ccb38cd4601a24aa7a4",
"89441265b92bf193457b05710eac9292c906ac62",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_timeupdate.html": [
@ -569421,7 +569421,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/event_timeupdate_noautoplay.html": [
"5156765c6bc0e4ce9f6d8ca55e48f5871046f7f4",
"c2120a0fdf26f370bd88d18794d4c3dc689730a2",
"testharness"
],
"html/semantics/embedded-content/media-elements/event_volumechange.html": [
@ -569577,11 +569577,11 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/loading-the-media-resource/autoplay-overrides-preload.html": [
"ffd2e043a1c07338b597366876b4ca0d79d75e16",
"7db53254abab5d2c6e83b3dff38e9aee24ea4de7",
"testharness"
],
"html/semantics/embedded-content/media-elements/loading-the-media-resource/load-events-networkState.html": [
"ad2401f93e135e6c9d618870bb07d92cfd0d8dcc",
"bb79a395a0297b288be526f72a7077628d130448",
"testharness"
],
"html/semantics/embedded-content/media-elements/loading-the-media-resource/load-removes-queued-error-event.html": [
@ -569769,7 +569769,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/networkState_during_progress.html": [
"55a5483997ec3c51f3cfb575c12e349935d83dbe",
"d57f05ca1884cc3dbdaac9130cba1f63adf693ed",
"testharness"
],
"html/semantics/embedded-content/media-elements/networkState_initial.html": [
@ -569785,7 +569785,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/paused_false_during_play.html": [
"ff28f3466bf3f0b6df316b774dd4ac28950dbcb7",
"d3a57220a6932719c521953e6ea83f340649dc2b",
"testharness"
],
"html/semantics/embedded-content/media-elements/paused_true_during_pause.html": [
@ -569825,27 +569825,27 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/ready-states/autoplay.html": [
"6ca8c7a50317c932254cf8254c7638d61f8bb00a",
"001cc2fc7405f443e1f83f1685c810371cc24de7",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_during_canplay.html": [
"7e3844240c9f1ffcde0e0cff68ca747e2ee4bd01",
"46f26243997dbf45039bca830b3b8faa46cafa73",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_during_canplaythrough.html": [
"93d9bd7ab6dc10b762ba51d50612421adae3da36",
"d0e49ab44c3919e861bda39e01cda4fcbc1196fa",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_during_loadeddata.html": [
"05eff7f919c9c471f4116d046eb83de3a11cb890",
"0f2040296385970bc1fbb2ffa8604e9d0857ff35",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_during_loadedmetadata.html": [
"648caf3811d8b1e07f9bfcc5f53b4be5b048f0d4",
"316ea9d578ba8216f3cfffbe8f13fec9eb648ddb",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_during_playing.html": [
"081d656eb789fa49e09fe0e5936eb10658321aa4",
"663689445bebed727f7fe181ace408ecb2254dcb",
"testharness"
],
"html/semantics/embedded-content/media-elements/readyState_initial.html": [
@ -570093,7 +570093,7 @@
"testharness"
],
"html/semantics/embedded-content/media-elements/video_008.htm": [
"087f17d5f7a75ac1990ef7ecb413fc4eaf312be5",
"e34c87a2821b7f307d858afe8b83154664e0e0b5",
"testharness"
],
"html/semantics/embedded-content/media-elements/video_controls_present-manual.html": [

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
[event_pause.html]
type: testharness
expected: TIMEOUT
[calling pause() on autoplay audio should trigger pause event]
expected: NOTRUN
expected: FAIL

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@
type: testharness
expected: TIMEOUT
[calling play() on a sufficiently long audio should trigger timeupdate event]
expected: NOTRUN
expected: FAIL
[calling play() on a sufficiently long video should trigger timeupdate event]
expected: NOTRUN

View file

@ -1,15 +1,14 @@
[autoplay-overrides-preload.html]
type: testharness
expected: TIMEOUT
[autoplay (set first) overrides preload "none"]
expected: TIMEOUT
expected: FAIL
[autoplay (set last) overrides preload "none"]
expected: TIMEOUT
expected: FAIL
[autoplay (set first) overrides preload "metadata"]
expected: TIMEOUT
expected: FAIL
[autoplay (set last) overrides preload "metadata"]
expected: TIMEOUT
expected: FAIL

View file

@ -1,6 +1,5 @@
[load-events-networkState.html]
type: testharness
expected: TIMEOUT
[NETWORK_IDLE]
expected: TIMEOUT
expected: FAIL

View file

@ -1,6 +1,5 @@
[paused_false_during_play.html]
type: testharness
expected: TIMEOUT
[audio.paused should be false during play event]
expected: NOTRUN
expected: FAIL

View file

@ -1,18 +1,17 @@
[autoplay.html]
type: testharness
expected: TIMEOUT
[audio.autoplay]
expected: TIMEOUT
expected: FAIL
[audio.autoplay and load()]
expected: TIMEOUT
expected: FAIL
[audio.autoplay and play()]
expected: TIMEOUT
expected: FAIL
[audio.autoplay and pause()]
expected: TIMEOUT
expected: FAIL
[audio.autoplay and internal pause steps]
expected: TIMEOUT
expected: FAIL

View file

@ -1,6 +1,5 @@
[readyState_during_canplay.html]
type: testharness
expected: TIMEOUT
[audio.readyState should be >= HAVE_FUTURE_DATA during canplay event]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[readyState_during_canplaythrough.html]
type: testharness
expected: TIMEOUT
[audio.readyState should be HAVE_ENOUGH_DATA during canplaythrough event]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[readyState_during_loadeddata.html]
type: testharness
expected: TIMEOUT
[audio.readyState should be >= HAVE_CURRENT_DATA during loadeddata event]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[readyState_during_loadedmetadata.html]
type: testharness
expected: TIMEOUT
[audio.readyState should be >= HAVE_METADATA during loadedmetadata event]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[readyState_during_playing.html]
type: testharness
expected: TIMEOUT
[audio.readyState should be >= HAVE_FUTURE_DATA during playing event]
expected: NOTRUN
expected: FAIL

View file

@ -1,6 +1,5 @@
[video_008.htm]
type: testharness
expected: TIMEOUT
[HTML5 Media Elements: 'media' attribute]
expected: NOTRUN
expected: FAIL

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>

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 a = document.getElementById("a");
var found_canplay = false;
a.addEventListener("canplay", function() {
a.addEventListener("error", t.unreached_func());
a.addEventListener("canplay", t.step_func(function() {
found_canplay = true;
});
a.addEventListener("canplaythrough", function() {
t.step(function() {
assert_true(found_canplay);
});
}));
a.addEventListener("canplaythrough", t.step_func(function() {
assert_true(found_canplay);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "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 v = document.getElementById("v");
var found_canplay = false;
v.addEventListener("canplay", function() {
v.addEventListener("error", t.unreached_func());
v.addEventListener("canplay", t.step_func(function() {
found_canplay = true;
});
v.addEventListener("canplaythrough", function() {
t.step(function() {
assert_true(found_canplay);
});
}));
v.addEventListener("canplaythrough", t.step_func(function() {
assert_true(found_canplay);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - canplay, then canplaythrough");
</script>

View file

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

View file

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

View file

@ -14,7 +14,7 @@
</video>
<div id="log"></div>
<script>
(function() {
test(function() {
var t = async_test("setting src attribute on autoplay audio should trigger loadstart then progress event", {timeout:5000});
var a = document.getElementById("a");
var found_loadstart = false;
@ -28,9 +28,9 @@
a.pause();
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
})();
}, "audio events - loadstart, then progress");
(function() {
test(function() {
var t = async_test("setting src attribute on autoplay video should trigger loadstart then progress event", {timeout:5000});
var v = document.getElementById("v");
var found_loadstart = false;
@ -44,7 +44,7 @@
v.pause();
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
})();
}, "video events - loadstart, then progress");
</script>
</body>
</html>

View file

@ -17,30 +17,22 @@
test(function() {
var t = async_test("calling pause() on autoplay audio should trigger pause event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("pause", function() {
t.step(function() {
assert_true(true);
});
t.done();
}, false);
a.addEventListener("play", function() {
a.addEventListener("error", t.unreached_func());
a.addEventListener("pause", t.step_func_done(), false);
a.addEventListener("play", t.step_func(function() {
a.pause(); // pause right after play
});
}));
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - pause");
test(function() {
var t = async_test("calling pause() on autoplay video should trigger pause event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("pause", function() {
t.step(function() {
assert_true(true);
});
t.done();
}, false);
v.addEventListener("play", function() {
v.addEventListener("error", t.unreached_func());
v.addEventListener("pause", t.step_func_done(), false);
v.addEventListener("play", t.step_func(function() {
v.pause(); // pause right after play
});
}));
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - pause");
</script>

View file

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

View file

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

View file

@ -14,7 +14,7 @@
</video>
<div id="log"></div>
<script>
(function() {
test(function() {
var t = async_test("setting src attribute on autoplay audio should trigger progress event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("error", t.unreached_func());
@ -23,9 +23,9 @@
a.pause();
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
})();
}, "audio events - progress");
(function() {
test(function() {
var t = async_test("setting src attribute on autoplay video should trigger progress event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("error", t.unreached_func());
@ -34,7 +34,7 @@
v.pause();
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
})();
}, "video events - progress");
</script>
</body>
</html>

View file

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

View file

@ -17,10 +17,11 @@
test(function() {
var t = async_test("calling play() on a sufficiently long audio should trigger timeupdate event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("timeupdate", function() {
a.addEventListener("error", t.unreached_func());
a.addEventListener("timeupdate", t.step_func(function() {
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
a.play();
}, "audio events - timeupdate");
@ -28,10 +29,11 @@ test(function() {
test(function() {
var t = async_test("calling play() on a sufficiently long video should trigger timeupdate event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("timeupdate", function() {
v.addEventListener("error", t.unreached_func());
v.addEventListener("timeupdate", t.step_func(function() {
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
v.play();
}, "video events - timeupdate");

View file

@ -17,6 +17,7 @@
a.preload = preload;
a.autoplay = true;
}
a.addEventListener('error', t.unreached_func());
a.addEventListener('playing', t.step_func(function() {
assert_equals(a.readyState, a.HAVE_ENOUGH_DATA);
assert_false(a.paused);

View file

@ -37,6 +37,7 @@ async_test(function(t) {
// fetch the resource" or "once the entire media resource has been fetched"
v.preload = 'none';
v.src = getAudioURI('/media/sound_5');
v.onerror = t.unreached_func();
v.onsuspend = t.step_func(function() {
v.onsuspend = null;
assert_equals(v.networkState, v.NETWORK_IDLE);
@ -47,6 +48,7 @@ async_test(function(t) {
async_test(function(t) {
var v = document.createElement('video');
v.src = 'resources/delayed-broken-video.py';
v.onerror = t.unreached_func();
v.onloadstart = t.step_func(function() {
v.onloadstart = null;
assert_equals(v.networkState, v.NETWORK_LOADING);

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>

View file

@ -17,26 +17,24 @@
test(function() {
var t = async_test("audio.paused should be false during play event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("play", function() {
t.step(function() {
assert_false(a.paused);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("play", t.step_func(function() {
assert_false(a.paused);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - paused property");
test(function() {
var t = async_test("video.paused should be false during play event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("play", function() {
t.step(function() {
assert_false(v.paused);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("play", t.step_func(function() {
assert_false(v.paused);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - paused property");
</script>

View file

@ -17,7 +17,7 @@ function autoplay_test(tagName, src) {
}
});
['canplay', 'canplaythrough',
'pause', 'play', 'playing'].forEach(function(type) {
'pause', 'play', 'playing', 'error'].forEach(function(type) {
e.addEventListener(type, callback);
});
}

View file

@ -17,26 +17,24 @@
test(function() {
var t = async_test("audio.readyState should be >= HAVE_FUTURE_DATA during canplay event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("canplay", function() {
t.step(function() {
assert_greater_than_equal(a.readyState, a.HAVE_FUTURE_DATA);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("canplay", t.step_func(function() {
assert_greater_than_equal(a.readyState, a.HAVE_FUTURE_DATA);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - readyState property during canplay");
test(function() {
var t = async_test("video.readyState should be >= HAVE_FUTURE_DATA during canplay event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("canplay", function() {
t.step(function() {
assert_greater_than_equal(v.readyState, v.HAVE_FUTURE_DATA);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("canplay", t.step_func(function() {
assert_greater_than_equal(v.readyState, v.HAVE_FUTURE_DATA);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - readyState property during canplay");
</script>

View file

@ -17,28 +17,24 @@
test(function() {
var t = async_test("audio.readyState should be HAVE_ENOUGH_DATA during canplaythrough event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("canplaythrough", function() {
t.step(function() {
assert_equals(a.readyState,
a.HAVE_ENOUGH_DATA);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("canplaythrough", t.step_func(function() {
assert_equals(a.readyState, a.HAVE_ENOUGH_DATA);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - readyState property during canplaythrough");
test(function() {
var t = async_test("video.readyState should be HAVE_ENOUGH_DATA during canplaythrough event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("canplaythrough", function() {
t.step(function() {
assert_equals(v.readyState,
v.HAVE_ENOUGH_DATA);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("canplaythrough", t.step_func(function() {
assert_equals(v.readyState, v.HAVE_ENOUGH_DATA);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - readyState property during canplaythrough");
</script>

View file

@ -17,26 +17,24 @@
test(function() {
var t = async_test("audio.readyState should be >= HAVE_CURRENT_DATA during loadeddata event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("loadeddata", function() {
t.step(function() {
assert_greater_than_equal(a.readyState, a.HAVE_CURRENT_DATA);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("loadeddata", t.step_func(function() {
assert_greater_than_equal(a.readyState, a.HAVE_CURRENT_DATA);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - readyState property during loadeddata");
test(function() {
var t = async_test("video.readyState should be >= HAVE_CURRENT_DATA during loadeddata event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("loadeddata", function() {
t.step(function() {
assert_greater_than_equal(v.readyState, v.HAVE_CURRENT_DATA);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("loadeddata", t.step_func(function() {
assert_greater_than_equal(v.readyState, v.HAVE_CURRENT_DATA);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - readyState property during loadeddata");
</script>

View file

@ -17,26 +17,24 @@
test(function() {
var t = async_test("audio.readyState should be >= HAVE_METADATA during loadedmetadata event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("loadedmetadata", function() {
t.step(function() {
assert_greater_than_equal(a.readyState, a.HAVE_METADATA);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("loadedmetadata", t.step_func(function() {
assert_greater_than_equal(a.readyState, a.HAVE_METADATA);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - readyState property during loadedmetadata");
test(function() {
var t = async_test("video.readyState should be >= HAVE_METADATA during loadedmetadata event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("loadedmetadata", function() {
t.step(function() {
assert_greater_than_equal(v.readyState, v.HAVE_METADATA);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("loadedmetadata", t.step_func(function() {
assert_greater_than_equal(v.readyState, v.HAVE_METADATA);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - readyState property during loadedmetadata");
</script>

View file

@ -17,26 +17,24 @@
test(function() {
var t = async_test("audio.readyState should be >= HAVE_FUTURE_DATA during playing event", {timeout:5000});
var a = document.getElementById("a");
a.addEventListener("playing", function() {
t.step(function() {
assert_greater_than_equal(a.readyState, a.HAVE_FUTURE_DATA);
});
a.addEventListener("error", t.unreached_func());
a.addEventListener("playing", t.step_func(function() {
assert_greater_than_equal(a.readyState, a.HAVE_FUTURE_DATA);
t.done();
a.pause();
}, false);
}), false);
a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
}, "audio events - readyState property during playing");
test(function() {
var t = async_test("video.readyState should be >= HAVE_FUTURE_DATA during playing event", {timeout:5000});
var v = document.getElementById("v");
v.addEventListener("playing", function() {
t.step(function() {
assert_greater_than_equal(v.readyState, v.HAVE_FUTURE_DATA);
});
v.addEventListener("error", t.unreached_func());
v.addEventListener("playing", t.step_func(function() {
assert_greater_than_equal(v.readyState, v.HAVE_FUTURE_DATA);
t.done();
v.pause();
}, false);
}), false);
v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
}, "video events - readyState property during playing");
</script>

View file

@ -21,12 +21,14 @@
videotest.done();
}
var do_error = videotest.unreached_func();
</script>
</head>
<body>
<div id='log'></div>
<video id="video0" autoplay onplay="do_play(event);">
<video id="video0" autoplay onplay="do_play(event);" onerror="do_error();">
<script type="text/javascript">
document.write(