Bug 1022524 - Mochitest for Bug 1022524. r=rillian

This commit is contained in:
Kilik Kuo 2014-08-26 14:33:08 +08:00
parent 88ac165dca
commit 8bf017e33a
9 changed files with 146 additions and 1 deletions

View File

@ -250,6 +250,70 @@ var gInvalidTests = [
{ name:"invalid-preskip.webm", type:"audio/webm; codecs=opus"},
];
// Files to check different cases of ogg skeleton information.
// sample-fisbone-skeleton4.ogv
// - Skeleton v4, w/ Content-Type,Role,Name,Language,Title for both theora/vorbis
// sample-fisbone-wrong-header.ogv
// - Skeleton v4, wrong message field sequence for vorbis
// multiple-bos-more-header-fields.ogg
// - Skeleton v3, w/ Content-Type,Role,Name,Language,Title for both theora/vorbis
// seek.ogv
// - No skeleton, but theora
// audio-overhang.ogg
// - No skeleton, but vorbis
var gMultitrackInfoOggPlayList = [
{ name:"sample-fisbone-skeleton4.ogv", type:"video/ogg", duration:5.049 },
{ name:"sample-fisbone-wrong-header.ogv", type:"video/ogg", duration:5.049 },
{ name:"multiple-bos-more-header-fileds.ogg", type:"video/ogg", duration:0.431 },
{ name:"seek.ogv", type:"video/ogg", duration:3.996 },
{ name:"audio-gaps.ogg", type:"audio/ogg", duration:2.208 }
];
// Pre-parsed results of gMultitrackInfoOggPlayList.
var gOggTrackInfoResults = {
"sample-fisbone-skeleton4.ogv" : {
"audio_id":" audio_1",
"audio_kind":"main",
"audio_language":" en-US",
"audio_label":" Audio track for test",
"video_id":" video_1",
"video_kind":"main",
"video_language":" fr",
"video_label":" Video track for test"
},
"sample-fisbone-wrong-header.ogv" : {
"audio_id":"1",
"audio_kind":"main",
"audio_language":"",
"audio_label":"",
"video_id":" video_1",
"video_kind":"main",
"video_language":" fr",
"video_label":" Video track for test"
},
"multiple-bos-more-header-fileds.ogg" : {
"audio_id":"1",
"audio_kind":"main",
"audio_language":"",
"audio_label":"",
"video_id":"2",
"video_kind":"main",
"video_language":"",
"video_label":""
},
"seek.ogv" : {
"video_id":"2",
"video_kind":"main",
"video_language":"",
"video_label":""
},
"audio-gaps.ogg" : {
"audio_id":"1",
"audio_kind":"main",
"audio_language":"",
"audio_label":""
}
};
// Converts a path/filename to a file:// URI which we can load from disk.
// Optionally checks whether the file actually exists on disk at the location
// we've specified.

View File

@ -173,6 +173,8 @@ support-files =
manifest.js
multiple-bos.ogg
multiple-bos.ogg^headers^
multiple-bos-more-header-fileds.ogg
multiple-bos-more-header-fileds.ogg^headers^
no-cues.webm
no-cues.webm^headers^
noContentLength.sjs
@ -203,6 +205,10 @@ support-files =
region.vtt
sample.3gp
sample.3g2
sample-fisbone-skeleton4.ogv
sample-fisbone-skeleton4.ogv^headers^
sample-fisbone-wrong-header.ogv
sample-fisbone-wrong-header.ogv^headers^
seek.ogv
seek.ogv^headers^
seek.webm
@ -371,6 +377,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' # mimetype check, bug 969289
[test_mediatrack_consuming_mediaresource.html]
[test_mediatrack_consuming_mediastream.html]
[test_mediatrack_events.html]
[test_mediatrack_parsing_ogg.html]
[test_mediatrack_replay_from_end.html]
[test_metadata.html]
[test_mixed_principals.html]
@ -454,7 +461,6 @@ skip-if = buildapp == 'b2g' # bug 1021682
[test_vttparser.html]
[test_webvtt_disabled.html]
# The tests below contain backend-specific tests. Write backend independent
# tests rather than adding to this list.
[test_can_play_type_webm.html]

Binary file not shown.

View File

@ -0,0 +1 @@
Cache-Control: no-store

Binary file not shown.

View File

@ -0,0 +1 @@
Cache-Control: no-store

Binary file not shown.

View File

@ -0,0 +1 @@
Cache-Control: no-store

View File

@ -0,0 +1,72 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test events of media track interfaces</title>
<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="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;
function localCheckMetadata(msg, e) {
ok(msg in gOggTrackInfoResults, "File: " + msg + " is in pre-parsed gOggTrackInfoResults list");
var r = gOggTrackInfoResults[msg];
var hasExpectedAudio = r && r.hasOwnProperty("audio_id");
var hasExpectedVideo = r && r.hasOwnProperty("video_id");
var hasParsedAudio = e.audioTracks.length >= 1;
var hasParsedVideo = e.videoTracks.length >= 1;
ok(!(hasExpectedAudio ^ hasParsedAudio), "Check availability of expected/parsed audio");
ok(!(hasExpectedVideo ^ hasParsedVideo), "Check availability of expected/parsed video");
if (hasParsedAudio) {
is(e.audioTracks.length, 1, "The length of audio track should be 1");
is(e.audioTracks[0].id, r.audio_id, "File: " + msg + ", Audio track id");
is(e.audioTracks[0].kind, r.audio_kind, "File: " + msg + ", Audio track kind");
is(e.audioTracks[0].language, r.audio_language, "File: " + msg + ", Audio track language");
is(e.audioTracks[0].label, r.audio_label, "File: " + msg + ", Audio track label");
}
if (hasParsedVideo) {
is(e.videoTracks.length, 1, "The length of video track should be 1");
is(e.videoTracks[0].id, r.video_id, "File: " + msg + ", Video track id");
is(e.videoTracks[0].kind, r.video_kind, "File: " + msg + ", Video track kind");
is(e.videoTracks[0].language, r.video_language, "File: " + msg + ", Video track language");
is(e.videoTracks[0].label, r.video_label, "File: " + msg + ", Video track label");
}
}
function startTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);
v.src = test.name;
v.name = test.name;
v.onloadedmetadata = function(evt) {
localCheckMetadata(evt.target.name, evt.target);
evt.target.finished = true;
evt.target.onloadedmetadata = null;
removeNodeAndSource(evt.target);
manager.finished(evt.target.token);
};
document.body.appendChild(v);
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.track.enabled", true]]},
function() {
manager.runTests(gMultitrackInfoOggPlayList, startTest);
}
);
</script>
</pre>
</body>
</html>