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