gecko/content/media/test/test_progress1.html

63 lines
1.7 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">
var completed = false;
var last_progress_total = 0;
function on_loadedmetadata() {
var v = document.getElementById('v');
ok(v, "Found video element after metadata loaded");
v.play();
dump('test_progress1: on_loadedmetadata exiting\n');
}
function do_progress(e) {
dump('test_progress1: do_progress ' + e.loaded + '\n');
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, 285310, "Check progress total");
}
function do_ended() {
dump('test_progress1: do_ended\n');
ok(!completed, "Check for duplicate ended event");
completed = true;
SimpleTest.finish();
}
function do_timeupdate() {
var v = document.getElementById('v');
dump('test_progress1: timeupdate: ' + v.currentTime + "\n");
}
function do_play() {
dump('test_progress1: do_play\n');
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
src='seek.ogv'
onloadedmetadata='on_loadedmetadata()'
onended='do_ended()'
ontimeupdate='do_timeupdate()'
onplay='do_play()'
onprogress='do_progress(event)'>
</video>
</body>
</html>