gecko/content/media/test/test_decode_error.html
Chris Pearce c7317b404d Bug 564720 - Refactor media tests to be backend independent were possible. r=roc
--HG--
rename : content/media/test/test_play.html => content/media/test/test_play_events.html
rename : content/media/test/test_progress2.html => content/media/test/test_progress.html
rename : content/media/test/test_onloadedmetadata.html => content/media/test/test_replay_metadata.html
rename : content/media/test/test_wav_trunc_seek.html => content/media/test/test_seek_out_of_range.html
rename : content/media/test/test_bug495319.html => content/media/test/test_timeupdate_small_files.html
rename : content/media/test/test_bug486646.html => content/media/test/test_video_to_canvas.html
2010-05-31 10:02:06 +12:00

66 lines
2.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Media test: unknown/invalid formats raise decode error</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="use_large_cache.js"></script>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var testsWaiting = 0;
gDecodeErrorTests.forEach(function (test, index) {
var v1 = document.createElement("video");
if (!v1.canPlayType(test.type)) {
return;
}
v1.addEventListener("error", function (event) {
event.stopPropagation();
var el = event.currentTarget;
is(event.type, "error", "Expected event of type 'error'");
ok(el.error, "Element 'error' attr expected to have a value");
ok(el.error instanceof HTMLMediaError, "Element 'error' attr expected to be HTMLMediaError");
is(el.error.code, HTMLMediaError.MEDIA_ERR_DECODE, "Expected a decode error");
is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY");
el._sawError = true;
}, false);
v1.addEventListener("emptied", function (event) {
var el = event.currentTarget;
is(el.networkState, HTMLMediaElement.NETWORK_EMPTY, "networkState should be EMPTY");
ok(el._sawError, "Expected error event");
testsWaiting -= 1;
if (testsWaiting == 0) {
SimpleTest.finish();
}
}, false);
v1.addEventListener("loadedmetadata", function () {
ok(false, "Unexpected loadedmetadata event");
}, false);
v1.autoplay = true;
v1.addEventListener("ended", function () {
ok(false, "Unexpected ended event");
}, false);
v1.src = test.name;
testsWaiting += 1;
v1.load();
});
if (testsWaiting > 0) {
SimpleTest.waitForExplicitFinish();
} else {
todo(false, "No types supported");
}
</script>
</pre>
</body>
</html>