summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_eme_non_mse_fails.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_eme_non_mse_fails.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_eme_non_mse_fails.html')
-rw-r--r--dom/media/test/test_eme_non_mse_fails.html103
1 files changed, 103 insertions, 0 deletions
diff --git a/dom/media/test/test_eme_non_mse_fails.html b/dom/media/test/test_eme_non_mse_fails.html
new file mode 100644
index 000000000..ede3edc5f
--- /dev/null
+++ b/dom/media/test/test_eme_non_mse_fails.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1131392 - Test that EME does not work for non-MSE media</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>
+ <script type="text/javascript" src="eme.js"></script>
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+var manager = new MediaTestManager;
+
+function DoSetMediaKeys(v, test)
+{
+ var options = [{
+ initDataTypes: ["cenc"],
+ audioCapabilities: [{contentType: test.audioType}],
+ videoCapabilities: [{contentType: test.videoType}],
+ }];
+
+ return navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, options)
+
+ .then(function(keySystemAccess) {
+ return keySystemAccess.createMediaKeys();
+ })
+
+ .catch(function() {
+ ok(false, token + " was not expecting failure (yet)");
+ })
+
+ .then(function(mediaKeys) {
+ return v.setMediaKeys(mediaKeys);
+ });
+}
+
+function TestSetMediaKeys(test, token)
+{
+ manager.started(token);
+
+ var v = document.createElement("video");
+
+ v.addEventListener("encrypted", function() {
+ ok(false, token + " should not fire encrypted event");
+ });
+
+ var loadedMetadata = false;
+ v.addEventListener("loadedmetadata", function() {
+ loadedMetadata = true;
+ });
+
+ v.addEventListener("error", function() {
+ ok(true, token + " expected error event");
+ ok(loadedMetadata, token + " expected loadedmetadata to have fired");
+ manager.finished(token);
+ });
+
+ v.src = test.name;
+}
+
+function TestSetSrc(test, token)
+{
+ manager.started(token);
+
+ var v = document.createElement("video");
+ v.addEventListener("error", function(err) {
+ ok(true, token + " got error setting src on video element, as expected");
+ manager.finished(token);
+ });
+
+ DoSetMediaKeys(v, test)
+
+ .then(function() {
+ v.src = test.name;
+ })
+
+ .catch(function() {
+ ok(false, token + " got error setting media keys");
+ });
+}
+
+function startTest(test, token)
+{
+ TestSetMediaKeys(test, token + "_setMediaKeys");
+ TestSetSrc(test, token + "_setSrc");
+}
+
+function beginTest() {
+ manager.runTests(gEMENonMSEFailTests, startTest);
+}
+
+if (!IsMacOSSnowLeopardOrEarlier()) {
+ SimpleTest.waitForExplicitFinish();
+ SetupEMEPref(beginTest);
+} else {
+ todo(false, "Test disabled on this platform.");
+}
+</script>
+</pre>
+</body>
+</html>
+