forked from mirrors/gecko-dev
Backed out changeset 1b6bef229ce4 (bug 1860492) Backed out changeset 22a3235fe2dc (bug 1860492) Backed out changeset a5b2e4d12e44 (bug 1860492) Backed out changeset cbcb811ca382 (bug 1860492) Backed out changeset d6a999866f19 (bug 1860492) Backed out changeset 40cee82fa090 (bug 1860492) Backed out changeset eeec1917ab49 (bug 1860492) Backed out changeset cf1230802d5c (bug 1860492) Backed out changeset b34aacf0e966 (bug 1860492) Backed out changeset 45d137c795f1 (bug 1860492) Backed out changeset fb667be5932d (bug 1860492) Backed out changeset a6d22d73c8a5 (bug 1860492) Backed out changeset c8b6c53698f5 (bug 1860492)
112 lines
2.5 KiB
HTML
112 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for Bug 479863</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>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
var manager = new MediaTestManager;
|
|
|
|
function checkSuspendCount(evt) {
|
|
var v = evt.target;
|
|
++v.suspendCount;
|
|
is(v.networkState, v.NETWORK_IDLE, v.name + " got suspended, count=" + v.suspendCount);
|
|
if (v.suspendCount == v.expectedSuspendCount) {
|
|
removeNodeAndSource(v);
|
|
manager.finished(v.name);
|
|
}
|
|
if (v.suspendCount > v.expectedSuspendCount) {
|
|
ok(false, v.name + " got too many suspend events");
|
|
}
|
|
}
|
|
|
|
var tests = [
|
|
{
|
|
name: 'v1',
|
|
preload: 'none',
|
|
expectedSuspendCount: 2,
|
|
onsuspend(evt) {
|
|
checkSuspendCount(evt);
|
|
if (evt.target.suspendCount == 1) {
|
|
evt.target.preload = 'auto';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'v2',
|
|
preload: 'auto',
|
|
expectedSuspendCount: 1,
|
|
onsuspend: checkSuspendCount
|
|
},
|
|
{
|
|
name: 'v3',
|
|
preload: 'none',
|
|
autoplay: true,
|
|
expectedSuspendCount: 1,
|
|
onsuspend: checkSuspendCount
|
|
},
|
|
{
|
|
name: 'v4',
|
|
preload: 'none',
|
|
expectedSuspendCount: 2,
|
|
onsuspend(evt) {
|
|
checkSuspendCount(evt);
|
|
if (evt.target.suspendCount == 1) {
|
|
evt.target.play();
|
|
}
|
|
}
|
|
},
|
|
// disable v5 since media element doesn't support 'load' event anymore.
|
|
/*{
|
|
name: 'v5',
|
|
preload: 'none',
|
|
expectedSuspendCount: 2,
|
|
onsuspend: function(evt) {
|
|
checkSuspendCount(evt);
|
|
if (evt.target.suspendCount == 1) {
|
|
evt.target.currentTime = 0.1;
|
|
}
|
|
}
|
|
},*/
|
|
{
|
|
name: 'v6',
|
|
preload: 'none',
|
|
expectedSuspendCount: 2,
|
|
onsuspend(evt) {
|
|
checkSuspendCount(evt);
|
|
if (evt.target.suspendCount == 1) {
|
|
evt.target.autoplay = true;
|
|
}
|
|
}
|
|
}
|
|
];
|
|
|
|
function startTest(test) {
|
|
var v = document.createElement("video");
|
|
v.name = test.name;
|
|
var key = Math.random();
|
|
v.src = "seek.ogv?key=" + key + "&id=" + v.name;
|
|
v.preload = test.preload;
|
|
v.suspendCount = 0;
|
|
v.expectedSuspendCount = test.expectedSuspendCount;
|
|
if (test.autoplay) {
|
|
v.autoplay = true;
|
|
}
|
|
v.onsuspend = test.onsuspend;
|
|
document.body.appendChild(v);
|
|
manager.started(v.name);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function() {
|
|
manager.runTests(tests, startTest);
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|