mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
c7317b404d
--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
79 lines
2.1 KiB
HTML
79 lines
2.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Media test: Bug 465498 - Seeking after playback 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" />
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465498">Mozilla Bug 465498</a>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
var videos = [];
|
|
|
|
function startTest(e) {
|
|
e.target.play();
|
|
}
|
|
|
|
function playbackEnded(e) {
|
|
var v = e.target;
|
|
if (v._finished)
|
|
return;
|
|
ok(v.currentTime >= v.duration - 0.1 && v.currentTime <= v.duration + 0.1,
|
|
"Checking currentTime at end: " + v.currentTime + " for " + v._name);
|
|
ok(v.ended, "Checking playback has ended for " + v._name);
|
|
v.pause();
|
|
v.currentTime = 0;
|
|
ok(!v.ended, "Checking ended is no longer true for " + v._name);
|
|
v._seeked = true;
|
|
}
|
|
|
|
function seekEnded(e) {
|
|
var v = e.target;
|
|
if (v._finished)
|
|
return;
|
|
ok(v.currentTime == 0, "Checking currentTime after seek: " +
|
|
v.currentTime + " for " + v._name);
|
|
ok(!v.ended, "Checking ended is false for " + v._name);
|
|
v._finished = true;
|
|
if (AllFinished(videos))
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
for (var i=0; i<gSmallTests.length; ++i) {
|
|
var test = gSmallTests[i];
|
|
var type = /^video/.test(test.type) ? "video" : "audio";
|
|
var v = document.createElement(type);
|
|
var test = gSmallTests[i];
|
|
if (!v.canPlayType(test.type))
|
|
continue;
|
|
v._name = test.name;
|
|
|
|
var s = document.createElement("source");
|
|
s.type = test.type;
|
|
s.src = test.name;
|
|
v.appendChild(s);
|
|
|
|
v._seeked = false;
|
|
v._finished = false;
|
|
v.addEventListener("loadedmetadata", startTest, false);
|
|
v.addEventListener("ended", playbackEnded, false);
|
|
v.addEventListener("seeked", seekEnded, false);
|
|
document.body.appendChild(v);
|
|
videos.push(v);
|
|
}
|
|
|
|
if (videos.length == 0) {
|
|
todo(false, "No types supported");
|
|
} else {
|
|
SimpleTest.waitForExplicitFinish();
|
|
}
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|