mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
91 lines
2.5 KiB
HTML
91 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=479863
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 479863</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<video id='v1'></video>
|
|
<video id='v2' preload="auto"></video>
|
|
<video id='v3' autoplay></video>
|
|
<video id='v4'></video>
|
|
<video id='v5'></video>
|
|
<video id='v6'></video>
|
|
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
function is() {}
|
|
|
|
var suspendCount = {};
|
|
var expectedSuspendCount = {v1:2, v2:1, v3:1, v4:2, v5:2, v6:2};
|
|
var totalSuspendCount = 0;
|
|
for (var i = 0; i < expectedSuspendCount.length; ++i) {
|
|
totalSuspendCount += expectedSuspendCount[i];
|
|
}
|
|
|
|
function suspended(event) {
|
|
// If the element suspends the download, it should not then be able to
|
|
// complete it, so we should be stuck in NETWORK_IDLE even though this
|
|
// event handler could run a long time after the actual suspend.
|
|
var expectedState = event.type == "load" ? event.target.NETWORK_LOADED
|
|
: event.target.NETWORK_IDLE;
|
|
|
|
is(event.target.networkState, expectedState,
|
|
event.target.id + " suspended networkState");
|
|
suspendCount[event.target.id]++;
|
|
|
|
--totalSuspendCount;
|
|
if (totalSuspendCount == 0) {
|
|
// We're done.
|
|
for (var i = 1; i <= 6; ++i) {
|
|
var id = "v" + i;
|
|
is(suspendCount[id], expectedSuspendCount[id], "Suspend count for " + id);
|
|
}
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
if (suspendCount[event.target.id] > 1)
|
|
return;
|
|
|
|
if (event.target.id == "v1") {
|
|
event.target.preload = "auto";
|
|
} else if (event.target.id == "v4") {
|
|
event.target.play();
|
|
} else if (event.target.id == "v5") {
|
|
event.target.currentTime = 0.1;
|
|
} else if (event.target.id == "v6") {
|
|
event.target.autoplay = true;
|
|
}
|
|
}
|
|
|
|
var key = Math.random();
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
|
function beginTest() {
|
|
for (var i = 1; i <= 6; ++i) {
|
|
var id = "v" + i;
|
|
var v = document.getElementById(id);
|
|
suspendCount[id] = 0;
|
|
v.addEventListener("suspend", suspended, false);
|
|
// Treat "load" as "suspend" for now, it means the same thing: we
|
|
// stopped the download.
|
|
v.addEventListener("load", suspended, false);
|
|
v.src = "seek.ogv?key=" + key + "&id=" + id;
|
|
}
|
|
}
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|