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">
|
|
|
|
// Test progress events with wav backend
|
|
|
|
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');
|
|
|
|
v.play();
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_progress(e) {
|
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, 102444, "Check progress total");
|
2009-01-15 12:26:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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>
|