2009-01-15 12:26:51 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Media test: progress events</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2009-01-15 12:26:51 -08:00
|
|
|
<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">
|
2009-03-31 17:52:56 -07:00
|
|
|
<script src="use_large_cache.js"></script>
|
2009-01-15 12:26:51 -08:00
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
var completed = false;
|
2009-02-05 00:02:21 -08:00
|
|
|
var last_progress_total = 0;
|
2009-01-15 12:26:51 -08:00
|
|
|
|
|
|
|
function on_loadedmetadata() {
|
|
|
|
var v = document.getElementById('v');
|
2009-02-05 00:02:21 -08:00
|
|
|
ok(v, "Found video element after metadata loaded");
|
2009-01-15 12:26:51 -08:00
|
|
|
v.play();
|
|
|
|
dump('test_progress1: on_loadedmetadata exiting\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_progress(e) {
|
|
|
|
dump('test_progress1: do_progress ' + e.loaded + '\n');
|
2009-02-05 00:02:21 -08:00
|
|
|
ok(!completed, "Check for progress event after completed");
|
2009-01-15 12:26:51 -08:00
|
|
|
ok(e.lengthComputable, "Check progress lengthComputable");
|
2009-02-05 00:02:21 -08:00
|
|
|
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");
|
2009-01-15 12:26:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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'
|
2009-01-16 01:07:26 -08:00
|
|
|
src='seek.ogv'
|
2009-01-15 12:26:51 -08:00
|
|
|
onloadedmetadata='on_loadedmetadata()'
|
|
|
|
onended='do_ended()'
|
|
|
|
ontimeupdate='do_timeupdate()'
|
|
|
|
onplay='do_play()'
|
|
|
|
onprogress='do_progress(event)'>
|
|
|
|
</video>
|
|
|
|
</body>
|
|
|
|
</html>
|