mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1242338 - test cases; r=jwwang
--HG-- extra : transplant_source : d%1F%1D0%14%EFr.o%D2pUyr%E8%CA%B8%AB%FD%01
This commit is contained in:
parent
300161c223
commit
38b05e6a4e
@ -480,7 +480,10 @@ var gSeekTests = [
|
||||
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 },
|
||||
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
|
||||
{ name:"owl.mp3", type:"audio/mpeg", duration:3.343 },
|
||||
{ name:"bogus.duh", type:"bogus/duh", duration:123 }
|
||||
{ name:"bogus.duh", type:"bogus/duh", duration:123 },
|
||||
|
||||
// Bug 1242338: hit a numerical problem while seeking to the duration.
|
||||
{ name:"bug482461-theora.ogv", type:"video/ogg", duration:4.138 },
|
||||
];
|
||||
|
||||
var gFastSeekTests = [
|
||||
|
@ -601,6 +601,7 @@ skip-if = os == 'win' && !debug # bug 1140675
|
||||
[test_bug1018933.html]
|
||||
[test_bug1113600.html]
|
||||
tags=capturestream
|
||||
[test_bug1242338.html]
|
||||
[test_can_play_type.html]
|
||||
[test_can_play_type_mpeg.html]
|
||||
skip-if = buildapp == 'b2g' || (toolkit == 'android' && processor == 'x86') # bug 1021675 #x86 only bug 914439
|
||||
|
66
dom/media/test/test_bug1242338.html
Normal file
66
dom/media/test/test_bug1242338.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Bug 1242338</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 video = document.createElement('video');
|
||||
video.preload = "metadata";
|
||||
video.token = token;
|
||||
|
||||
var handler = {
|
||||
"ontimeout": function() {
|
||||
Log(token, "timed out");
|
||||
}
|
||||
};
|
||||
manager.started(token, handler);
|
||||
|
||||
video.src = test.name;
|
||||
video.name = test.name;
|
||||
|
||||
function finish() {
|
||||
video.finished = true;
|
||||
video.removeEventListener("loadedmetadata", onLoadedmetadata, false);
|
||||
video.removeEventListener("ended", onEnded, false);
|
||||
removeNodeAndSource(video);
|
||||
manager.finished(video.token);
|
||||
}
|
||||
|
||||
function onLoadedmetadata() {
|
||||
// seek to the media's duration
|
||||
var duration = video.duration;
|
||||
console.log("onloadedmetadata(), duration = " + duration);
|
||||
video.currentTime = duration;
|
||||
}
|
||||
|
||||
function onEnded() {
|
||||
ok(video.ended, test.name + " checking playback has ended");
|
||||
ok(!video.finished, test.name + " shouldn't be finished");
|
||||
ok(!video.seenEnded, test.name + " shouldn't be ended");
|
||||
video.seenEnded = true;
|
||||
|
||||
ok(true, "Seeking to the duration triggers ended event");
|
||||
finish();
|
||||
}
|
||||
|
||||
video.addEventListener("loadedmetadata", onLoadedmetadata, false);
|
||||
video.addEventListener("ended", onEnded, false);
|
||||
|
||||
document.body.appendChild(video);
|
||||
}
|
||||
|
||||
manager.runTests(gSeekTests, startTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user