2010-08-05 11:40:35 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=462957
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 462957</title>
|
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/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>
|
|
|
|
<script type="application/javascript" src="use_large_cache.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462957">Mozilla Bug 462957</a>
|
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
// Test for Bug 462957; HTMLMediaElement.buffered.
|
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
var manager = new MediaTestManager;
|
2010-08-05 11:40:35 +04:00
|
|
|
|
|
|
|
function ended(e) {
|
|
|
|
var v = e.target;
|
|
|
|
|
|
|
|
// The whole media should be buffered...
|
|
|
|
var b = v.buffered;
|
|
|
|
is(b.length, 1, v._name + ": Should be buffered in one range");
|
|
|
|
is(b.start(0), 0, v._name + ": First range start should be media start");
|
|
|
|
is(b.end(0), v.duration, v._name + ": First range end should be media end");
|
2010-08-05 11:40:35 +04:00
|
|
|
|
|
|
|
// Ensure INDEX_SIZE_ERR is thrown when we access outside the range
|
|
|
|
var caught = false;
|
|
|
|
try {
|
|
|
|
b.start(-1);
|
|
|
|
} catch (e) {
|
|
|
|
caught = e.code == DOMException.INDEX_SIZE_ERR;
|
|
|
|
}
|
|
|
|
is(caught, true, "Should throw INDEX_SIZE_ERR on under start bounds range");
|
|
|
|
|
|
|
|
caught = false;
|
|
|
|
try {
|
|
|
|
b.end(-1);
|
|
|
|
} catch (e) {
|
|
|
|
caught = e.code == DOMException.INDEX_SIZE_ERR;
|
|
|
|
}
|
|
|
|
is(caught, true, "Should throw INDEX_SIZE_ERR on under end bounds range");
|
|
|
|
|
|
|
|
caught = false;
|
|
|
|
try {
|
|
|
|
b.start(b.length);
|
|
|
|
} catch (e) {
|
|
|
|
caught = e.code == DOMException.INDEX_SIZE_ERR;
|
|
|
|
}
|
|
|
|
is(caught, true, "Should throw INDEX_SIZE_ERR on over start bounds range");
|
|
|
|
|
|
|
|
caught = false;
|
|
|
|
try {
|
|
|
|
b.end(b.length);
|
|
|
|
} catch (e) {
|
|
|
|
caught = e.code == DOMException.INDEX_SIZE_ERR;
|
|
|
|
}
|
|
|
|
is(caught, true, "Should throw INDEX_SIZE_ERR on over end bounds range");
|
2010-08-05 11:40:35 +04:00
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
v.parentNode.removeChild(v);
|
|
|
|
manager.finished(v.token);
|
|
|
|
|
2010-08-05 11:40:35 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
function startTest(test, token) {
|
2010-08-05 11:40:35 +04:00
|
|
|
var v = document.createElement('video');
|
2010-08-27 06:11:46 +04:00
|
|
|
v.token = token;
|
|
|
|
manager.started(token);
|
|
|
|
|
2010-08-05 11:40:35 +04:00
|
|
|
v.src = test.name;
|
|
|
|
v._name = test.name;
|
|
|
|
v._test = test;
|
|
|
|
v._finished = false;
|
|
|
|
v.autoplay = true;
|
|
|
|
v.addEventListener("ended", ended, false);
|
|
|
|
document.body.appendChild(v);
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
manager.runTests(gSeekTests, startTest);
|
2010-08-05 11:40:35 +04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|