2008-08-04 05:51:01 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=448534
|
|
|
|
-->
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 448534</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
2010-05-31 02:02:06 +04:00
|
|
|
<script type="text/javascript" src="manifest.js"></script>
|
2008-08-04 05:51:01 +04:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448535">Mozilla Bug 448534</a>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
2008-10-19 11:39:21 +04:00
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
var manager = new MediaTestManager;
|
2008-10-19 11:39:21 +04:00
|
|
|
|
2010-05-31 02:02:06 +04:00
|
|
|
function loaded(event) {
|
|
|
|
var v = event.target;
|
2014-12-29 00:33:00 +03:00
|
|
|
info(v.token + ": event=" + event.type);
|
2010-05-31 02:02:06 +04:00
|
|
|
if (v._finished)
|
2012-08-15 08:41:24 +04:00
|
|
|
return;
|
2008-10-19 11:39:21 +04:00
|
|
|
v.play();
|
|
|
|
}
|
|
|
|
|
2010-05-31 02:02:06 +04:00
|
|
|
function started(event) {
|
|
|
|
var v = event.target;
|
2014-12-29 00:33:00 +03:00
|
|
|
info(v.token + ": event=" + event.type);
|
2015-01-06 03:50:00 +03:00
|
|
|
// For a short file, it could reach the end before 'play' received. We will
|
|
|
|
// skip the test for 'paused' would be true when ended.
|
|
|
|
if (v._finished || v.ended)
|
2012-08-15 08:41:24 +04:00
|
|
|
return;
|
2014-12-29 00:33:00 +03:00
|
|
|
ok(!v.paused, v.token + ": Video should not be paused while playing");
|
2017-01-30 10:10:22 +03:00
|
|
|
v.remove();
|
2010-05-31 02:02:06 +04:00
|
|
|
v._played = true;
|
2008-08-04 05:51:01 +04:00
|
|
|
}
|
|
|
|
|
2010-05-31 02:02:06 +04:00
|
|
|
function stopped(event) {
|
|
|
|
var v = event.target;
|
2014-12-29 00:33:00 +03:00
|
|
|
info(v.token + ": event=" + event.type);
|
2010-05-31 02:02:06 +04:00
|
|
|
if (v._finished)
|
2012-08-15 08:41:24 +04:00
|
|
|
return;
|
2010-05-31 02:02:06 +04:00
|
|
|
v._finished = true;
|
2014-12-29 00:33:00 +03:00
|
|
|
ok(v.paused, v.token + ": Video should be paused after removing from the Document");
|
2014-10-02 02:36:00 +04:00
|
|
|
removeNodeAndSource(v);
|
2010-08-27 06:11:46 +04:00
|
|
|
manager.finished(v.token);
|
2008-08-04 05:51:01 +04:00
|
|
|
}
|
|
|
|
|
2010-05-31 02:02:06 +04:00
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
function startTest(test, token) {
|
2010-05-31 02:02:06 +04:00
|
|
|
var v = document.createElement('video');
|
2013-07-31 11:35:44 +04:00
|
|
|
v.preload = "metadata";
|
2010-08-27 06:11:46 +04:00
|
|
|
v.token = token;
|
|
|
|
manager.started(token);
|
2010-05-31 02:02:06 +04:00
|
|
|
v.src = test.name;
|
|
|
|
v._played = false;
|
|
|
|
v._finished = false;
|
2017-01-17 13:50:25 +03:00
|
|
|
v.addEventListener("loadedmetadata", loaded);
|
|
|
|
v.addEventListener("play", started);
|
|
|
|
v.addEventListener("pause", stopped);
|
2010-05-31 02:02:06 +04:00
|
|
|
document.body.appendChild(v);
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:11:46 +04:00
|
|
|
manager.runTests(gSmallTests, startTest);
|
2010-05-31 02:02:06 +04:00
|
|
|
|
2008-08-04 05:51:01 +04:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|