mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1235301 - part 5 - mochitest;r=jwwang
MozReview-Commit-ID: 6NzyMk8pFS7 --HG-- extra : rebase_source : b8a9c09b3e04cc91bb553d9a6f84b71024c3247d
This commit is contained in:
parent
94991011ed
commit
6ba3ad8ecf
@ -276,6 +276,53 @@ var gPlayTests = [
|
||||
{ name:"bogus.duh", type:"bogus/duh", duration:Number.NaN },
|
||||
];
|
||||
|
||||
var gSeekToNextFrameTests = [
|
||||
// Test playback of a WebM file with vp9 video
|
||||
{ name:"vp9.webm", type:"video/webm", duration:4 },
|
||||
{ name:"vp9cake.webm", type:"video/webm", duration:7.966 },
|
||||
// oggz-chop stream
|
||||
{ name:"bug482461.ogv", type:"video/ogg", duration:4.34 },
|
||||
// Theora only oggz-chop stream
|
||||
{ name:"bug482461-theora.ogv", type:"video/ogg", duration:4.138 },
|
||||
// With first frame a "duplicate" (empty) frame.
|
||||
{ name:"bug500311.ogv", type:"video/ogg", duration:1.96 },
|
||||
|
||||
// More audio in file than video.
|
||||
{ name:"short-video.ogv", type:"video/ogg", duration:1.081 },
|
||||
// First Theora data packet is zero bytes.
|
||||
{ name:"bug504613.ogv", type:"video/ogg", duration:Number.NaN },
|
||||
// Multiple audio streams.
|
||||
{ name:"bug516323.ogv", type:"video/ogg", duration:4.208 },
|
||||
// oggz-chop with non-keyframe as first frame
|
||||
{ name:"bug556821.ogv", type:"video/ogg", duration:2.551 },
|
||||
// Various weirdly formed Ogg files
|
||||
{ name:"bug498855-1.ogv", type:"video/ogg", duration:0.24 },
|
||||
{ name:"bug498855-2.ogv", type:"video/ogg", duration:0.24 },
|
||||
{ name:"bug498855-3.ogv", type:"video/ogg", duration:0.24 },
|
||||
{ name:"bug504644.ogv", type:"video/ogg", duration:1.6 },
|
||||
|
||||
{ name:"bug523816.ogv", type:"video/ogg", duration:0.533 },
|
||||
|
||||
{ name:"bug498380.ogv", type:"video/ogg", duration:0.533 },
|
||||
{ name:"bug557094.ogv", type:"video/ogg", duration:0.24 },
|
||||
{ name:"multiple-bos.ogg", type:"video/ogg", duration:0.431 },
|
||||
// Test playback/metadata work after a redirect
|
||||
{ name:"redirect.sjs?domain=mochi.test:8888&file=320x240.ogv",
|
||||
type:"video/ogg", duration:0.266 },
|
||||
// Test playback of a webm file
|
||||
{ name:"seek.webm", type:"video/webm", duration:3.966 },
|
||||
// Test playback of a WebM file with non-zero start time.
|
||||
{ name:"split.webm", type:"video/webm", duration:1.967 },
|
||||
// Test playback of a raw file
|
||||
{ name:"seek.yuv", type:"video/x-raw-yuv", duration:1.833 },
|
||||
|
||||
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
|
||||
|
||||
// Test playback of a MP4 file with a non-zero start time (and audio starting
|
||||
// a second later).
|
||||
{ name:"bipbop-lateaudio.mp4", type:"video/mp4" },
|
||||
];
|
||||
|
||||
// A file for each type we can support.
|
||||
var gSnifferTests = [
|
||||
{ name:"big.wav", type:"audio/x-wav", duration:9.278982, size:102444 },
|
||||
|
@ -799,6 +799,8 @@ skip-if = true # bug 1021673
|
||||
[test_seek-13.html]
|
||||
[test_seekable1.html]
|
||||
[test_seekLies.html]
|
||||
[test_seekToNextFrame.html]
|
||||
tags=seektonextframe
|
||||
[test_source.html]
|
||||
[test_source_media.html]
|
||||
[test_source_null.html]
|
||||
|
81
dom/media/test/test_seekToNextFrame.html
Normal file
81
dom/media/test/test_seekToNextFrame.html
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test seekToNextFrame of media files that should play OK</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 startTest(test, token) {
|
||||
var v = document.createElement('video');
|
||||
v.preload = "metadata";
|
||||
v.token = token;
|
||||
v.seenSeeking = false;
|
||||
v.seenEnded = false;
|
||||
|
||||
var handler = {
|
||||
"ontimeout": function() {
|
||||
Log(token, "timed out: ended=" + v.seenEnded);
|
||||
}
|
||||
};
|
||||
manager.started(token, handler);
|
||||
|
||||
v.src = test.name;
|
||||
v.name = test.name;
|
||||
|
||||
var onLoadedmetadata = function(test, v) { return function() {
|
||||
v.seekToNextFrame();
|
||||
}}(test, v);
|
||||
|
||||
var finish = function() {
|
||||
v.finished = true;
|
||||
v.removeEventListener("loadedmetadata", onLoadedmetadata, false);
|
||||
v.removeEventListener("seeking", onSeeking, false);
|
||||
v.removeEventListener("seeked", onSeeked, false);
|
||||
removeNodeAndSource(v);
|
||||
manager.finished(v.token);
|
||||
}
|
||||
|
||||
var onEnded = function(test, v) { return function() {
|
||||
v.seenEnded = true;
|
||||
finish();
|
||||
}}(test, v);
|
||||
|
||||
var onSeeking = function(test, v) { return function() {
|
||||
ok(!v.seenSeeking, "Should yet receive seeking event.")
|
||||
v.seenSeeking = true;
|
||||
}}(test, v);
|
||||
|
||||
var onSeeked = function(test, v) { return function() {
|
||||
ok(v.seenSeeking, "Should have already received seeking event.")
|
||||
v.seenSeeking = false;
|
||||
v.seekToNextFrame();
|
||||
}}(test, v);
|
||||
|
||||
v.addEventListener("loadedmetadata", onLoadedmetadata, false);
|
||||
v.addEventListener("seeking", onSeeking, false);
|
||||
v.addEventListener("seeked", onSeeked, false);
|
||||
v.addEventListener("ended", onEnded, false);
|
||||
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
"set": [["media.seekToNextFrame.enabled", true ]]
|
||||
},
|
||||
function() {
|
||||
manager.runTests(gSeekToNextFrameTests, startTest);
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user