Bug 1431169 - P3. Stop playback mochitest on error. r?rillian
Otherwise we need to wait for the test to timeout as the ended event won't be fired.
MozReview-Commit-ID: HKgkG40Dz6w
--- a/dom/media/test/test_playback.html
+++ b/dom/media/test/test_playback.html
@@ -34,16 +34,20 @@ function startTest(test, token) {
is(test.name, v.name, test.name + ": Name should match #1");
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
+ var noError = function(test, v) { return function() {
+ ok(false, test.name + " should not fire 'error' event " + v.error.message);
+ }}(test, v);
+
var finish = function() {
v.finished = true;
v.removeEventListener("timeupdate", timeUpdate);
removeNodeAndSource(v);
manager.finished(v.token);
}
// We should get "ended" and "suspend" events to finish the test.
@@ -79,16 +83,17 @@ function startTest(test, token) {
if (v.prevTime > v.currentTime) {
ok(false, test.name + " time should run forwards: p=" +
v.prevTime + " c=" + v.currentTime);
}
v.prevTime = v.currentTime;
}}(test, v);
v.addEventListener("load", noLoad);
+ v.addEventListener("error", noError);
v.addEventListener("loadedmetadata", check);
v.addEventListener("timeupdate", timeUpdate);
// We should get "ended" and "suspend" events for every resource
v.addEventListener("ended", checkEnded);
v.addEventListener("suspend", checkSuspended);
document.body.appendChild(v);