mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
0d460e3432
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
64 lines
1.7 KiB
HTML
64 lines
1.7 KiB
HTML
<!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 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=495300">Mozilla Bug 495300</a>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
var manager = new MediaTestManager;
|
|
|
|
function filename(uri) {
|
|
return uri.substr(uri.lastIndexOf("/")+1);
|
|
}
|
|
|
|
function mediaEnded(event) {
|
|
ok(true, "Got expected 'ended' event: " + filename(event.target.currentSrc));
|
|
|
|
if (event.target._expectedDuration)
|
|
ok(Math.abs(event.target.currentTime - event.target._expectedDuration) < 0.1,
|
|
"currentTime equals duration: " + filename(event.target.currentSrc));
|
|
|
|
event.target.removeEventListener("ended", mediaEnded);
|
|
manager.finished(event.target.token);
|
|
removeNodeAndSource(event.target);
|
|
}
|
|
|
|
function mediaLoadedmetadata(event) {
|
|
event.target.currentTime = event.target.duration;
|
|
event.target.removeEventListener("loadedmetadata", mediaLoadedmetadata);
|
|
}
|
|
|
|
function startTest(test, token) {
|
|
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
|
var v1 = document.createElement(elemType);
|
|
v1.preload = "auto";
|
|
|
|
v1.src = test.name;
|
|
if (test.duration) {
|
|
v1._expectedDuration = test.duration;
|
|
}
|
|
v1.addEventListener("loadedmetadata", mediaLoadedmetadata);
|
|
v1.addEventListener("ended", mediaEnded);
|
|
v1.load();
|
|
|
|
v1.token = token;
|
|
manager.started(token);
|
|
}
|
|
|
|
manager.runTests(gSeekTests, startTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|