2009-05-31 03:02:17 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=495300
|
|
|
|
-->
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Bug 495300 - seeking to the end should behave as "ended"</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" />
|
2009-10-19 19:48:03 -07:00
|
|
|
<script type="text/javascript" src="manifest.js"></script>
|
2009-05-31 03:02:17 -07:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=495300">Mozilla Bug 495300</a>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
2009-10-19 19:48:03 -07:00
|
|
|
var testsWaiting = 0;
|
2009-05-31 03:02:17 -07:00
|
|
|
|
2009-10-19 19:48:03 -07:00
|
|
|
function mediaEnded(event) {
|
|
|
|
ok(true, "Got expected 'ended' event: " + event.target.currentSrc);
|
|
|
|
|
|
|
|
if (event.target._expectedDuration)
|
|
|
|
ok(Math.abs(event.target.currentTime - event.target._expectedDuration) < 0.1,
|
|
|
|
"currentTime equals duration: " + event.target.currentSrc);
|
|
|
|
|
|
|
|
if (--testsWaiting == 0)
|
|
|
|
SimpleTest.finish();
|
2009-05-31 03:02:17 -07:00
|
|
|
}
|
|
|
|
|
2009-10-19 19:48:03 -07:00
|
|
|
for (var i = 0; i < gSeekTests.length; ++i) {
|
|
|
|
var test = gSeekTests[i];
|
|
|
|
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
|
|
|
var v1 = document.createElement(elemType);
|
|
|
|
if (!v1.canPlayType(test.type))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
v1.src = test.name;
|
|
|
|
if (test.duration) {
|
|
|
|
v1._expectedDuration = test.duration;
|
|
|
|
}
|
|
|
|
v1.addEventListener("loadedmetadata", function (event) {
|
|
|
|
event.target.currentTime = event.target.duration;
|
|
|
|
}, false);
|
|
|
|
v1.addEventListener("ended", mediaEnded, false);
|
|
|
|
v1.load();
|
|
|
|
|
|
|
|
++testsWaiting;
|
2009-05-31 03:02:17 -07:00
|
|
|
}
|
|
|
|
|
2009-10-19 19:48:03 -07:00
|
|
|
if (testsWaiting == 0) {
|
|
|
|
todo(false, "Can't play anything");
|
|
|
|
} else {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
}
|
2009-05-31 03:02:17 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|