Bug 1231793: Part 7 - Fixed various tests. r=jya

This commit is contained in:
Louis Christie 2016-02-12 14:40:41 +13:00 committed by Jean-Yves Avenard
parent 2ab805fef1
commit 780d874dc2
3 changed files with 7 additions and 11 deletions

View File

@ -681,6 +681,7 @@ var gMetadataTests = [
{ name:"wave_metadata_bad_len.wav", tags: { { name:"wave_metadata_bad_len.wav", tags: {
name:"Track Title", name:"Track Title",
artist:"Artist Name", artist:"Artist Name",
comments:"Comments",
} }
}, },
{ name:"wave_metadata_bad_no_null.wav", tags: { { name:"wave_metadata_bad_no_null.wav", tags: {

View File

@ -20,24 +20,19 @@ function startTest(test, token) {
ok(el.error, "Element 'error' attr expected to have a value"); ok(el.error, "Element 'error' attr expected to have a value");
ok(el.error instanceof MediaError, "Element 'error' attr expected to be MediaError"); ok(el.error instanceof MediaError, "Element 'error' attr expected to be MediaError");
is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error"); is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error");
is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY");
el._sawError = true; el._sawError = true;
}, false);
v.addEventListener("emptied", function (event) {
var el = event.currentTarget;
is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY");
ok(el._sawError, "Expected error event");
manager.finished(token); manager.finished(token);
}, false); }, false);
v.addEventListener("loadedmetadata", function () { v.addEventListener("loadeddata", function () {
ok(false, "Unexpected loadedmetadata event"); ok(false, "Unexpected loadeddata event");
manager.finished(token);
}, false); }, false);
v.autoplay = true; v.autoplay = true;
v.addEventListener("ended", function () { v.addEventListener("ended", function () {
ok(false, "Unexpected ended event"); ok(false, "Unexpected ended event");
manager.finished(token);
}, false); }, false);
v.src = test.name; // implicitly starts a load. v.src = test.name; // implicitly starts a load.

View File

@ -23,11 +23,11 @@ function finishTest(a) {
function decodeUsingAudioElement() { function decodeUsingAudioElement() {
var a = new Audio(); var a = new Audio();
a.addEventListener("error", function() { a.addEventListener("error", function() {
ok(true, "We should not be able to decode this file using an HTMLAudioElement"); ok(false, "Error loading metadata");
finishTest(a); finishTest(a);
}); });
a.addEventListener("loadedmetadata", function() { a.addEventListener("loadedmetadata", function() {
ok(false, "We should not be able to decode this file using an HTMLMediaElement."); ok(true, "Metadata Loaded");
finishTest(a); finishTest(a);
}); });