mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
66 lines
1.6 KiB
HTML
66 lines
1.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test mozLoadFrom API</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 cloneLoaded(event) {
|
|
ok(true, "Clone loaded OK");
|
|
var e = event.target;
|
|
|
|
if (e._expectedDuration) {
|
|
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
|
|
"Clone " + e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
|
|
}
|
|
|
|
manager.finished(e.token);
|
|
}
|
|
|
|
function tryClone(event) {
|
|
var e = event.target;
|
|
var clone = e.cloneNode(false);
|
|
clone.token = e.token;
|
|
|
|
if (e._expectedDuration) {
|
|
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
|
|
e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);
|
|
clone._expectedDuration = e._expectedDuration;
|
|
}
|
|
|
|
clone.mozLoadFrom(e);
|
|
is(clone.currentSrc, e.currentSrc, "Clone source OK");
|
|
|
|
clone.addEventListener("loadeddata", cloneLoaded, false);
|
|
}
|
|
|
|
function initTest(test, token) {
|
|
var elemType = /^audio/.test(test.type) ? "audio" : "video";
|
|
var e = document.createElement(elemType);
|
|
if (e.canPlayType(test.type)) {
|
|
e.src = test.name;
|
|
if (test.duration) {
|
|
e._expectedDuration = test.duration;
|
|
}
|
|
e.addEventListener("loadeddata", tryClone, false);
|
|
e.load();
|
|
e.token = token;
|
|
manager.started(token);
|
|
}
|
|
}
|
|
|
|
manager.runTests(gCloneTests, initTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|