summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_playback_reactivate.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/test_playback_reactivate.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_playback_reactivate.html')
-rw-r--r--dom/media/test/test_playback_reactivate.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/dom/media/test/test_playback_reactivate.html b/dom/media/test/test_playback_reactivate.html
new file mode 100644
index 000000000..8b768c8e7
--- /dev/null
+++ b/dom/media/test/test_playback_reactivate.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test playback with dormant of media files that should play OK</title>
+ <script type="text/javascript" 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.
+*/
+
+// longer timeout for slow platforms
+if (isSlowPlatform()) {
+ SimpleTest.requestLongerTimeout(1.5);
+ SimpleTest.requestCompleteLog();
+}
+
+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, false);
+ v.addEventListener("ended", checkEnded, false);
+
+ document.body.appendChild(v);
+
+ // Debug timeouts on slow platforms.
+ if (isSlowPlatform()) {
+ var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
+ "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
+ "waiting", "pause"];
+ function logEvent(e) {
+ var v = e.target;
+ Log(e.target.token, "got " + e.type);
+ }
+ events.forEach(function(e) {
+ v.addEventListener(e, logEvent, false);
+ });
+ }
+}
+
+manager.runTests(gSmallTests, startTest);
+
+</script>
+</pre>
+</body>
+</html>