summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_decode_error.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_decode_error.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_decode_error.html')
-rw-r--r--dom/media/test/test_decode_error.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/dom/media/test/test_decode_error.html b/dom/media/test/test_decode_error.html
new file mode 100644
index 000000000..e940fcd18
--- /dev/null
+++ b/dom/media/test/test_decode_error.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media test: unknown/invalid formats raise decode error</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">
+var manager = new MediaTestManager;
+
+function startTest(test, token) {
+ var ok = function (condition, name) {
+ SimpleTest.ok(condition, test.name + ": " + name);
+ }
+ var is = function (a, b, name) {
+ SimpleTest.is(a, b, test.name + ": " + name);
+ }
+
+ var v = document.createElement("video");
+ manager.started(token);
+ v.addEventListener("error", function (event) {
+ var el = event.currentTarget;
+ is(event.type, "error", "Expected event of type 'error'");
+ ok(el.error, "Element 'error' attr expected to have a value");
+ ok(el.error instanceof MediaError, "Element 'error' attr expected to be MediaError");
+ if (v.readyState == v.HAVE_NOTHING) {
+ is(el.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, "Expected media not supported error");
+ } else {
+ is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error");
+ }
+ ok(typeof el.error.message === 'string' || el.error.essage instanceof String, "Element 'message' attr expected to be a string");
+ ok(el.error.message.length > 0, "Element 'message' attr has content");
+ el._sawError = true;
+ manager.finished(token);
+ }, false);
+
+ v.addEventListener("loadeddata", function () {
+ ok(false, "Unexpected loadeddata event");
+ manager.finished(token);
+ }, false);
+
+ v.autoplay = true;
+ v.addEventListener("ended", function () {
+ ok(false, "Unexpected ended event");
+ manager.finished(token);
+ }, false);
+
+ v.src = test.name; // implicitly starts a load.
+}
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({
+ "set": [
+ ["media.cache_size", 40000],
+ ]
+}, beginTest);
+function beginTest() {
+ manager.runTests(gDecodeErrorTests, startTest);
+}
+</script>
+</pre>
+</body>
+</html>