mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
75 lines
2.1 KiB
HTML
75 lines
2.1 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">
|
|
// Same as test_progress1 but uses a smaller file to test resource loaded
|
|
// before metadata loaded is fired.
|
|
var completed = false;
|
|
var load_count = 0;
|
|
var last_progress = 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_progress3: on_loadedmetadata exiting\n');
|
|
}
|
|
|
|
function do_progress(e) {
|
|
dump('test_progress3: do_progress ' + e.loaded + '/' + e.total + '\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, 28942, "Check progress total");
|
|
last_progress = e.loaded;
|
|
}
|
|
|
|
function do_ended() {
|
|
dump('test_progress3: do_ended\n');
|
|
ok(!completed, "Check for duplicate ended event");
|
|
completed = true;
|
|
is(last_progress, 28942, "Last progress event size");
|
|
is(load_count, 1, "load event raised");
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function do_load(e) {
|
|
load_count++;
|
|
dump('test_progress3: do_loaded ' + e.loaded + "\n");
|
|
}
|
|
|
|
function do_timeupdate() {
|
|
var v = document.getElementById('v');
|
|
dump('test_progress3: timeupdate: ' + v.currentTime + "\n");
|
|
}
|
|
|
|
function do_play() {
|
|
dump('test_progress3: do_play\n');
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
</script>
|
|
</pre>
|
|
<video id='v'
|
|
src='320x240.ogv'
|
|
onloadedmetadata='on_loadedmetadata()'
|
|
onended='do_ended()'
|
|
ontimeupdate='do_timeupdate()'
|
|
onload='do_load(event)'
|
|
onplay='do_play()'
|
|
onprogress='do_progress(event)'>
|
|
</video>
|
|
</body>
|
|
</html>
|