pjs/content/media/test/test_progress2.html

48 строки
1.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Media test: progress events</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script src="use_large_cache.js"></script>
<script class="testbody" type="text/javascript">
// Test progress events with wav backend
var completed = false;
var last_progress_total = 0;
function on_loadedmetadata() {
var v = document.getElementById('v');
v.play();
}
function do_progress(e) {
ok(!completed, "Check for progress event after completed");
ok(e.lengthComputable, "Check progress lengthComputable");
ok(e.loaded >= last_progress_total, "Check progress increasing: " + e.loaded);
last_progress_total = e.loaded;
ok(e.loaded <= e.total, "Check progress in bounds: " + e.loaded);
is(e.total, 102444, "Check progress total");
}
function do_ended() {
ok(!completed, "Check for duplicate ended event");
completed = true;
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
src='big.wav'
onloadedmetadata='on_loadedmetadata()'
onended='do_ended()'
onprogress='do_progress(event)'>
</audio>
</body>
</html>