summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_media_sniffer.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_media_sniffer.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_media_sniffer.html')
-rw-r--r--dom/media/test/test_media_sniffer.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/media/test/test_media_sniffer.html b/dom/media/test/test_media_sniffer.html
new file mode 100644
index 000000000..a4988e710
--- /dev/null
+++ b/dom/media/test/test_media_sniffer.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media test: sniffing</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) {
+ element.removeEventListener("error", onerror, false);
+ removeNodeAndSource(element);
+ manager.finished(element.token);
+}
+
+function onmetadataloaded(e) {
+ var t = e.target;
+ ++t.srcIndex;
+ ok(true, "The media loads when loaded via " + t.src);
+ if (t.srcIndex < t.srcList.length) {
+ t.src = t.srcList[t.srcIndex];
+ } else {
+ finish_test(t);
+ }
+}
+
+function onerror(e) {
+ var t = e.target;
+ t.removeEventListener('error', onerror);
+ ok(false, "The media could not be loaded." + t.src + "\n");
+ finish_test(t);
+}
+
+function startTest(test, token) {
+ var elemType = /^audio/.test(test.type) ? "audio" : "video";
+ var element = document.createElement(elemType);
+ // This .sjs file serve the media file without Content-Type header, or with a
+ // specific Content-Type header.
+ var baseSrc = 'contentType.sjs?file=' + test.name;
+ element.srcList = [
+ baseSrc + "&nomime",
+ baseSrc + "&type=application/octet-stream",
+ baseSrc + "&type=audio/wav",
+ baseSrc + "&type=text/html",
+ baseSrc + "&type=absolute_nonsense"
+ ];
+ element.srcIndex = 0;
+ element.src = element.srcList[element.srcIndex];
+ element.token = token;
+ element.controls = true;
+ element.preload = "metadata";
+ document.body.appendChild(element);
+ manager.started(token);
+ element.addEventListener("loadedmetadata", onmetadataloaded);
+ element.addEventListener("error", onerror);
+}
+
+manager.runTests(gSnifferTests, startTest);
+</script>
+</pre>
+</body>
+</html>