gecko/content/media/test/test_progress4.html

50 lines
1.4 KiB
HTML
Raw Normal View History

<!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
// Same as test_progress2 but uses a smaller file to test resource loaded
// before metadata loaded is fired.
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, 11069, "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='r11025_u8_c1.wav'
onloadedmetadata='on_loadedmetadata()'
onended='do_ended()'
onprogress='do_progress(event)'>
</audio>
</body>
</html>