summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_chaining.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_chaining.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_chaining.html')
-rw-r--r--dom/media/test/test_chaining.html87
1 files changed, 87 insertions, 0 deletions
diff --git a/dom/media/test/test_chaining.html b/dom/media/test/test_chaining.html
new file mode 100644
index 000000000..8e74393b7
--- /dev/null
+++ b/dom/media/test/test_chaining.html
@@ -0,0 +1,87 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media test: chained ogg files.</title>
+ <meta charset='utf-8'>
+ <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">
+var manager = new MediaTestManager;
+
+function finish_test(element) {
+ removeNodeAndSource(element);
+ manager.finished(element.token);
+}
+
+function onended(e) {
+ var t = e.target;
+ is(t._metadataCount, t._links, "We should have received "+ t._links +
+ " metadataloaded event. " + t.src);
+
+ // If we encounter a file that has links with a different numbers of channel,
+ // we stop the decoding at the end of the first link. Hence, we report normal
+ // |seekable| and |buffered| values.
+ if (t._links != 1) {
+ is(t.seekable.length, 0, "No seekable ranges should be reported." + t.src);
+ is(t.buffered.length, 0, "No buffered region should be reported." + t.src);
+ }
+
+ is(t.played.length, 1, "The played region should be continuous." + t.src);
+
+ if (t._links != 1) {
+ var oldCurrentTime = t.currentTime;
+ t.currentTime = 0.0;
+ is(t.currentTime, oldCurrentTime,
+ "Seeking should be disabled when playing chained media." + t.src);
+ }
+
+ finish_test(t);
+}
+
+function onmetadataloaded(e) {
+ var t = e.target;
+ if (! t._metadataCount) {
+ t._metadataCount = 0;
+ }
+
+ if (t._metadataCount > 1 && t._links === 1) {
+ ok(false, "We should receive only one \"loadedmetadata\" event for a chained file we don't support.")
+ }
+
+ // We should be able to assert equality here, but somehow it fails (rarely but
+ // still) on try. Instead, we give it a little slack and assert that the index
+ // increases monotonically.
+ ok(t.mozGetMetadata().index >= t._metadataCount || t._links === 1,
+ "The metadata index value should increase." + t.src);
+
+ // The files have all a user comment name 'index' that increments at each link
+ // in the chained media.
+ t._metadataCount++;
+ if (!t.playing && !t.ended) {
+ t.play();
+ }
+}
+
+function startTest(test, token) {
+ var elemType = /^audio/.test(test.type) ? "audio" : "video";
+ var element = document.createElement(elemType);
+ document.body.appendChild(element);
+ manager.started(token);
+ element._links= test.links;
+ element.src = test.name;
+ element.token = token;
+ element.controls = true;
+ element.addEventListener("loadedmetadata", onmetadataloaded);
+ element.addEventListener("ended", onended);
+ element.preload = "metadata";
+}
+
+manager.runTests(gChainingTests, startTest);
+</script>
+</pre>
+</body>
+</html>