forked from mirrors/gecko-dev
Backed out changeset 61a4022333fa (bug 1556854) Backed out changeset cfd809c63877 (bug 1556854) Backed out changeset 057cc9878594 (bug 1556854) Backed out changeset 0f02ff8a5c67 (bug 1556854) Backed out changeset 8719996c65b3 (bug 1556854)
77 lines
2.1 KiB
HTML
77 lines
2.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test playback with dormant of media files that should play OK</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
</head>
|
|
<body>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
/* This testcase wants to test a video element's playback is not break
|
|
by dormant.
|
|
When the metadata is loaded, we remove the video element to trigger dormant.
|
|
Then set a timer to append the video element back and play it.
|
|
Test pass if the video plays to the end.
|
|
*/
|
|
|
|
var manager = new MediaTestManager;
|
|
|
|
function startTest(test, token) {
|
|
var v = document.createElement('video');
|
|
v.preload = "metadata";
|
|
v.token = token;
|
|
|
|
var handler = {
|
|
"ontimeout": function() {
|
|
Log(token, "timed out: ended=" + v.seenEnded + ", suspend=" + v.seenSuspend);
|
|
}
|
|
};
|
|
manager.started(token, handler);
|
|
|
|
v.src = test.name;
|
|
v.name = test.name;
|
|
|
|
var check = function(test, v) { return function() {
|
|
is(test.name, v.name, test.name + ": Name should match #1");
|
|
Log(v.token, "removeChild: " + v.name);
|
|
document.body.removeChild(v);
|
|
var appendAndPlayElement = function() {
|
|
Log(v.token, "appendChild: " + v.name);
|
|
document.body.appendChild(v);
|
|
Log(v.token, "Element play: " + v.name);
|
|
v.play();
|
|
}
|
|
setTimeout(appendAndPlayElement, 2000);
|
|
}}(test, v);
|
|
|
|
var finish = function() {
|
|
v.finished = true;
|
|
removeNodeAndSource(v);
|
|
manager.finished(v.token);
|
|
}
|
|
|
|
var checkEnded = function(test, v) { return function() {
|
|
is(test.name, v.name, test.name + ": Name should match #2");
|
|
checkMetadata(test.name, v, test);
|
|
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
|
|
ok(v.ended, test.name + " checking playback has ended");
|
|
|
|
finish();
|
|
}}(test, v);
|
|
|
|
|
|
v.addEventListener("loadedmetadata", check);
|
|
v.addEventListener("ended", checkEnded);
|
|
|
|
document.body.appendChild(v);
|
|
}
|
|
|
|
manager.runTests(gSmallTests, startTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|