summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-17 13:05:20 +0200
committerMoonchild <moonchild@palemoon.org>2023-10-17 16:37:43 +0200
commit7a10dcaadf95a379a2b7ce242fb3e1fb3f4f4ca9 (patch)
tree94fc529a9f667f226b2ff8f70d0cb452564aadd7 /dom
parenta63cf31989546298a7990c2f993239064b2126b5 (diff)
downloaduxp-7a10dcaadf95a379a2b7ce242fb3e1fb3f4f4ca9.tar.gz
Issue #2346 - Update tests
Diffstat (limited to 'dom')
-rw-r--r--dom/media/test/mochitest.ini35
-rw-r--r--dom/media/test/test_eme_canvas_blocked.html58
-rw-r--r--dom/media/test/test_eme_detach_media_keys.html63
-rw-r--r--dom/media/test/test_eme_initDataTypes.html133
-rw-r--r--dom/media/test/test_eme_missing_pssh.html92
-rw-r--r--dom/media/test/test_eme_non_mse_fails.html103
-rw-r--r--dom/media/test/test_eme_playback.html188
-rw-r--r--dom/media/test/test_eme_requestKeySystemAccess.html484
-rw-r--r--dom/media/test/test_eme_request_notifications.html88
-rw-r--r--dom/media/test/test_eme_session_callable_value.html35
-rw-r--r--dom/media/test/test_eme_setMediaKeys_before_attach_MediaSource.html41
-rw-r--r--dom/media/test/test_eme_stream_capture_blocked_case1.html52
-rw-r--r--dom/media/test/test_eme_stream_capture_blocked_case2.html55
-rw-r--r--dom/media/test/test_eme_stream_capture_blocked_case3.html54
-rw-r--r--dom/media/test/test_eme_waitingforkey.html117
15 files changed, 0 insertions, 1598 deletions
diff --git a/dom/media/test/mochitest.ini b/dom/media/test/mochitest.ini
index 516c2beb03..2699c03ac2 100644
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -425,9 +425,6 @@ support-files =
dirac.ogg^headers^
dynamic_redirect.sjs
dynamic_resource.sjs
-#ifdef MOZ_EME
- eme.js
-#endif
file_access_controls.html
flac-s24.flac
flac-s24.flac^headers^
@@ -684,38 +681,6 @@ tags=capturestream
[test_decoder_disable.html]
[test_defaultMuted.html]
[test_delay_load.html]
-#ifdef MOZ_EME
-[test_eme_session_callable_value.html]
-[test_eme_canvas_blocked.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_detach_media_keys.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_initDataTypes.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_missing_pssh.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_non_mse_fails.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_request_notifications.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_playback.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_requestKeySystemAccess.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_setMediaKeys_before_attach_MediaSource.html]
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_stream_capture_blocked_case1.html]
-tags=msg capturestream
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_stream_capture_blocked_case2.html]
-tags=msg capturestream
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_stream_capture_blocked_case3.html]
-tags=msg capturestream
-skip-if = toolkit == 'android' # bug 1149374
-[test_eme_waitingforkey.html]
-skip-if = toolkit == 'android' # bug 1149374
-#endif
[test_empty_resource.html]
[test_error_in_video_document.html]
[test_error_on_404.html]
diff --git a/dom/media/test/test_eme_canvas_blocked.html b/dom/media/test/test_eme_canvas_blocked.html
deleted file mode 100644
index e84b6db402..0000000000
--- a/dom/media/test/test_eme_canvas_blocked.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 startTest(test, token)
-{
- manager.started(token);
-
- var sessions = [];
-
- var v = SetupEME(test, token);
- v.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
-
- v.addEventListener("loadeddata", function(ev) {
- var video = ev.target;
- var canvas = document.createElement("canvas");
- canvas.width = video.videoWidth;
- canvas.height = video.videoHeight;
- document.body.appendChild(canvas);
- var ctx = canvas.getContext("2d");
- var threwError = false;
- try {
- ctx.drawImage(video, 0, 0);
- } catch (ex) {
- threwError = true;
- }
- ok(threwError, TimeStamp(token) + " - Should throw an error when trying to draw EME video to canvas.");
- manager.finished(token);
- });
-
- LoadTestWithManagedLoadToken(test, v, manager, token,
- { onlyLoadFirstFragments:2, noEndOfStream:false });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_detach_media_keys.html b/dom/media/test/test_eme_detach_media_keys.html
deleted file mode 100644
index 6d3dc8467e..0000000000
--- a/dom/media/test/test_eme_detach_media_keys.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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">
-<video id="v" controls></video>
-<script class="testbody" type="text/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-function createAndSet() {
- return new Promise(function(resolve, reject) {
- var m;
- navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, gCencMediaKeySystemConfig)
- .then(function (access) {
- return access.createMediaKeys();
- })
- .then(function (mediaKeys) {
- m = mediaKeys;
- return document.getElementById("v").setMediaKeys(mediaKeys);
- })
- .then(function() {
- resolve(m);
- });
- }
-)}
-
-var m1,m2;
-
-// Test that if we create and set two MediaKeys on one video element,
-// that if the first MediaKeys we set on the media elemnt is still usable
-// after the second MediaKeys has been set on the media element.
-SetupEMEPref(() => {
- createAndSet().then((m) => {
- m1 = m; // Stash MediaKeys.
- return createAndSet();
- })
- .then((m) => {
- m2 = m;
- is(document.getElementById("v").mediaKeys, m2, "Should have set MediaKeys on media element");
- ok(document.getElementById("v").mediaKeys != m1, "First MediaKeys should no longer be set on media element");
- var s = m1.createSession("temporary");
- return s.generateRequest("webm", StringToArrayBuffer(atob('YAYeAX5Hfod+V9ANHtANHg==')));
- })
- .then(() => {
- ok(true, "Was able to generateRequest using second CDM");
- SimpleTest.finish();
- }, () => {
- ok(false, "Was *NOT* able to generateRequest using second CDM");
- SimpleTest.finish();
- });
-});
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_initDataTypes.html b/dom/media/test/test_eme_initDataTypes.html
deleted file mode 100644
index 4821c3cb82..0000000000
--- a/dom/media/test/test_eme_initDataTypes.html
+++ /dev/null
@@ -1,133 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 tests = [
- {
- name: "One keyId",
- initDataType: 'keyids',
- initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"]}',
- expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"],"type":"temporary"}',
- sessionType: 'temporary',
- expectPass: true,
- },
- {
- name: "Two keyIds",
- initDataType: 'keyids',
- initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
- expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"temporary"}',
- sessionType: 'temporary',
- expectPass: true,
- },
- {
- name: "Two keyIds, temporary session",
- initDataType: 'keyids',
- initData: '{"type":"temporary", "kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
- expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"temporary"}',
- sessionType: 'temporary',
- expectPass: true,
- },
- {
- name: "Two keyIds, persistent session, type before kids",
- initDataType: 'keyids',
- initData: '{"type":"persistent-license", "kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
- expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"persistent-license"}',
- sessionType: 'persistent-license',
- expectPass: false,
- },
- {
- name: "Invalid keyId",
- initDataType: 'keyids',
- initData: '{"kids":["0"]}',
- sessionType: 'temporary',
- expectPass: false,
- },
- {
- name: "Empty keyId",
- initDataType: 'keyids',
- initData: '{"kids":[""]}',
- sessionType: 'temporary',
- expectPass: false,
- },
- {
- name: "Invalid initData",
- initDataType: 'keyids',
- initData: 'invalid initData',
- sessionType: 'temporary',
- expectPass: false,
- },
- {
- name: "'webm' initDataType",
- initDataType: 'webm',
- initData: 'YAYeAX5Hfod+V9ANHtANHg==',
- expectedRequest: '{"kids":["YAYeAX5Hfod-V9ANHtANHg"],"type":"temporary"}',
- sessionType: 'temporary',
- expectPass: true,
- },
- {
- name: "'webm' initDataType with non 16 byte keyid",
- initDataType: 'webm',
- initData: 'YAYeAX5Hfod',
- expectedRequest: '{\"kids\":[\"YAYeAX5Hfoc\"],\"type\":\"temporary\"}',
- sessionType: 'temporary',
- expectPass: true,
- },
-];
-
-function PrepareInitData(initDataType, initData)
-{
- if (initDataType == "keyids") {
- return new TextEncoder().encode(initData);
- } else if (initDataType == "webm") {
- return StringToArrayBuffer(atob(initData));
- }
-}
-
-function Test(test) {
- return new Promise(function(resolve, reject) {
- var configs = [{
- initDataTypes: [test.initDataType],
- videoCapabilities: [{contentType: 'video/mp4' }],
- }];
- navigator.requestMediaKeySystemAccess('org.w3.clearkey', configs)
- .then((access) => access.createMediaKeys())
- .then((mediaKeys) => {
- var session = mediaKeys.createSession(test.sessionType);
- session.addEventListener("message", function(event) {
- is(event.messageType, "license-request", "'" + test.name + "' MediaKeyMessage type should be license-request.");
- var text = new TextDecoder().decode(event.message);
- is(text, test.expectedRequest, "'" + test.name + "' got expected response.");
- is(text == test.expectedRequest, test.expectPass,
- "'" + test.name + "' expected to " + (test.expectPass ? "pass" : "fail"));
- resolve();
- });
- var initData = PrepareInitData(test.initDataType, test.initData);
- return session.generateRequest(test.initDataType, initData);
- }
- ).catch((x) => {
- ok(!test.expectPass, "'" + test.name + "' expected to fail.");
- resolve();
- });
- });
-}
-
-function beginTest() {
- Promise.all(tests.map(Test)).then(function() { SimpleTest.finish(); });
-}
-
-SimpleTest.waitForExplicitFinish();
-SetupEMEPref(beginTest);
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_missing_pssh.html b/dom/media/test/test_eme_missing_pssh.html
deleted file mode 100644
index 196ced4022..0000000000
--- a/dom/media/test/test_eme_missing_pssh.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <title>Test Encrypted Media Extensions</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>
- <audio controls id="audio"></audio>
- <pre id="test">
- <script class="testbody" type="text/javascript">
-
- // Tests that a fragmented MP4 file without a PSSH, but with valid encrypted
- // tracks with valid TENC boxes, is able to load with EME.
- // We setup MSE before starting up EME, so that we exercise the "waiting for
- // cdm" step in the MediaDecoderStateMachine.
-
- SimpleTest.waitForExplicitFinish();
-
- var pssh = [
- 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x73, 0x73, 0x68, // BMFF box header (76 bytes, 'pssh')
- 0x01, 0x00, 0x00, 0x00, // Full box header (version = 1, flags = 0)
- 0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, 0x4d, 0x02, // SystemID
- 0xac, 0xe3, 0x3c, 0x1e, 0x52, 0xe2, 0xfb, 0x4b,
- 0x00, 0x00, 0x00, 0x01, // KID_count (1)
- 0x2f, 0xef, 0x8a, 0xd8, 0x12, 0xdf, 0x42, 0x97,
- 0x83, 0xe9, 0xbf, 0x6e, 0x5e, 0x49, 0x3e, 0x53,
- 0x00, 0x00, 0x00, 0x00 // Size of Data (0)
- ];
-
- var audio = document.getElementById("audio");
-
- function LoadEME() {
- var options = [{
- initDataType: 'cenc',
- audioType: 'audio/mp4; codecs="mp4a.40.2"',
- }];
- navigator.requestMediaKeySystemAccess("org.w3.clearkey", options)
- .then((keySystemAccess) => {
- return keySystemAccess.createMediaKeys();
- }, bail("Failed to request key system access."))
-
- .then((mediaKeys) => {
- audio.setMediaKeys(mediaKeys);
- var session = mediaKeys.createSession();
- once(session, "message", (message) => {
- is(message.messageType, 'license-request', "Expected a license-request");
- var license = new TextEncoder().encode(JSON.stringify({
- 'keys': [{
- 'kty':'oct',
- 'kid':'L--K2BLfQpeD6b9uXkk-Uw',
- 'k':HexToBase64('7f412f0575f44f718259beef56ec7771')
- }],
- 'type': 'temporary'
- }));
- session.update(license);
- });
- session.generateRequest('cenc', new Uint8Array(pssh));
- });
- }
-
- function DownloadMedia(url, type, mediaSource) {
- return new Promise(function(resolve, reject) {
- var sourceBuffer = mediaSource.addSourceBuffer(type);
- fetchWithXHR(url, (response) => {
- once(sourceBuffer, "updateend", resolve);
- sourceBuffer.appendBuffer(new Uint8Array(response));
- });
- });
- }
-
- function LoadMSE() {
- var ms = new MediaSource();
- audio.src = URL.createObjectURL(ms);
-
- once(ms, "sourceopen", ()=>{
- DownloadMedia('short-audio-fragmented-cenc-without-pssh.mp4', 'audio/mp4; codecs="mp4a.40.2"', ms)
- .then(() => { ms.endOfStream(); LoadEME();});
- });
-
- audio.addEventListener("loadeddata", SimpleTest.finish);
- }
-
- SetupEMEPref(LoadMSE);
-
- </script>
- </pre>
- </body>
-</html>
diff --git a/dom/media/test/test_eme_non_mse_fails.html b/dom/media/test/test_eme_non_mse_fails.html
deleted file mode 100644
index ede3edc5f2..0000000000
--- a/dom/media/test/test_eme_non_mse_fails.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!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>
-
diff --git a/dom/media/test/test_eme_playback.html b/dom/media/test/test_eme_playback.html
deleted file mode 100644
index a568402cd6..0000000000
--- a/dom/media/test/test_eme_playback.html
+++ /dev/null
@@ -1,188 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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="http://test1.mochi.test:8888/tests/dom/media/test/eme.js"></script>
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-var manager = new MediaTestManager;
-
-function ArrayBuffersEqual(a, b) {
- if (a.byteLength != b.byteLength) {
- return false;
- }
- var ua = new Uint8Array(a);
- var ub = new Uint8Array(b);
- for (var i = 0; i < ua.length; i++) {
- if (ua[i] != ub[i]) {
- return false;
- }
- }
- return true;
-}
-
-function KeysChangeFunc(session, keys, token) {
- session.keyIdsReceived = [];
- for (var keyid in keys) {
- Log(token, "Set " + keyid + " to false in session[" + session.sessionId + "].keyIdsReceived");
- session.keyIdsReceived[keyid] = false;
- }
- return function(ev) {
- var session = ev.target;
- session.gotKeysChanged = true;
-
- var keyList = [];
- var valueList = [];
- var map = session.keyStatuses;
-
- // Test that accessing keys not known to the CDM has expected behaviour.
- var absentKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
- 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
- is(map.has(absentKey), false, "Shouldn't have a key that's not in the media");
- is(map.get(absentKey), undefined, "Unknown keys should undefined status");
-
- // Verify known keys have expected status.
- for (var [key, val] of map.entries()) {
- is(key.constructor, ArrayBuffer, "keyId should be ArrayBuffer");
- ok(map.has(key), "MediaKeyStatusMap.has() should work.");
- is(map.get(key), val, "MediaKeyStatusMap.get() should work.");
- keyList.push(key);
- valueList.push(val);
- is(val, "usable", token + ": key status should be usable");
- var kid = Base64ToHex(window.btoa(ArrayBufferToString(key)));
- ok(kid in session.keyIdsReceived, TimeStamp(token) + " session[" + session.sessionId + "].keyIdsReceived contained " + kid + " as expected.");
- session.keyIdsReceived[kid] = true;
- }
-
- var index = 0;
- for (var keyId of map.keys()) {
- ok(ArrayBuffersEqual(keyId, keyList[index]), "MediaKeyStatusMap.keys() should correspond to entries");
- index++;
- }
- index = 0;
- for (var val of map.values()) {
- is(val, valueList[index], "MediaKeyStatusMap.values() should correspond to entries");
- index++;
- }
- }
-}
-
-function startTest(test, token)
-{
- manager.started(token);
-
- var sessions = [];
-
- var v = SetupEME(test, token,
- {
- onsessioncreated: function(session) {
- sessions.push(session);
- session.addEventListener("keystatuseschange", KeysChangeFunc(session, test.keys, token), false);
-
- session.numKeystatuseschangeEvents = 0;
- session.numOnkeystatuseschangeEvents = 0;
-
- session.addEventListener("keystatuseschange", function() {
- session.numKeystatuseschangeEvents += 1;
- });
- session.onkeystatuseschange = function() {
- session.numOnkeystatuseschangeEvents += 1;
- };
-
- session.numMessageEvents = 0;
- session.numOnMessageEvents = 0;
- session.addEventListener("message", function() {
- session.numMessageEvents += 1;
- });
- session.onmessage = function() {
- session.numOnMessageEvents += 1;
- };
- }
- }
- );
-
- document.body.appendChild(v);
-
- var gotEncrypted = 0;
-
- v.addEventListener("encrypted", function(ev) {
- gotEncrypted += 1;
- });
-
- v.addEventListener("loadedmetadata", function() {
- ok(SpecialPowers.do_lookupGetter(v, "isEncrypted").apply(v),
- TimeStamp(token) + " isEncrypted should be true");
- is(v.isEncrypted, undefined, "isEncrypted should not be accessible from content");
- });
-
- v.addEventListener("ended", function(ev) {
- ok(true, TimeStamp(token) + " got ended event");
-
- is(gotEncrypted, test.sessionCount,
- TimeStamp(token) + " encrypted events expected: " + test.sessionCount
- + ", actual: " + gotEncrypted);
-
- ok(Math.abs(test.duration - v.duration) < 0.1,
- TimeStamp(token) + " Duration of video should be corrrect");
- ok(Math.abs(test.duration - v.currentTime) < 0.1,
- TimeStamp(token) + " Current time should be same as duration");
-
- // Verify all sessions had all keys went sent to the CDM usable, and thus
- // that we received keystatuseschange event(s).
- is(sessions.length, test.sessionCount, TimeStamp(token) + " should have "
- + test.sessionCount
- + " session" + (test.sessionCount === 1 ? "" : "s"));
- var keyIdsReceived = [];
- for (var keyid in test.keys) { keyIdsReceived[keyid] = false; }
- for (var i = 0; i < sessions.length; i++) {
- var session = sessions[i];
- ok(session.gotKeysChanged,
- TimeStamp(token) + " session[" + session.sessionId
- + "] should have received at least one keychange event");
- for (var kid in session.keyIdsReceived) {
- Log(token, "session[" + session.sessionId + "] key " + kid + " = " + (session.keyIdsReceived[kid] ? "true" : "false"));
- if (session.keyIdsReceived[kid]) { keyIdsReceived[kid] = true; }
- }
- ok(session.numKeystatuseschangeEvents > 0, TimeStamp(token) + " should get key status changes");
- is(session.numKeystatuseschangeEvents, session.numOnkeystatuseschangeEvents,
- TimeStamp(token) + " should have as many keystatuseschange event listener calls as event handler calls.");
-
- ok(session.numMessageEvents > 0, TimeStamp(token) + " should get message events");
- is(session.numMessageEvents, session.numOnMessageEvents,
- TimeStamp(token) + " should have as many message event listener calls as event handler calls.");
- }
- for (var kid in keyIdsReceived) {
- ok(keyIdsReceived[kid], TimeStamp(token) + " key with id " + kid + " was usable as expected");
- }
-
- v.closeSessions().then(() => manager.finished(token));
- });
-
- LoadTest(test, v, token)
- .then(function() {
- v.play();
- }).catch(function() {
- ok(false, token + " failed to load");
- manager.finished(token);
- });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_requestKeySystemAccess.html b/dom/media/test/test_eme_requestKeySystemAccess.html
deleted file mode 100644
index 21ee91a68c..0000000000
--- a/dom/media/test/test_eme_requestKeySystemAccess.html
+++ /dev/null
@@ -1,484 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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">
-
-const SUPPORTED_LABEL = "pass label";
-
-function ValidateConfig(name, expected, observed) {
- info("ValidateConfig " + name);
- info("expected cfg=" + JSON.stringify(expected));
- info("observed cfg=" + JSON.stringify(observed));
-
- is(observed.label, expected.label, name + " label should match");
- if (expected.initDataTypes) {
- ok(expected.initDataTypes.every((element, index, array) => observed.initDataTypes.includes(element)), name + " initDataTypes should match.");
- }
-
- if (expected.audioCapabilities) {
- ok(expected.audioCapabilities.length == 1, "Test function can only handle one capability.");
- ok(observed.audioCapabilities.length == 1, "Test function can only handle one capability.");
- is(observed.audioCapabilities[0].contentType, expected.audioCapabilities[0].contentType, name + " audioCapabilities should match.");
- }
- if (typeof expected.videoCapabilities !== 'undefined') {
- info("expected.videoCapabilities=" + expected.videoCapabilities);
- dump("expected.videoCapabilities=" + expected.videoCapabilities + "\n");
- ok(expected.videoCapabilities.length == 1, "Test function can only handle one capability.");
- ok(observed.videoCapabilities.length == 1, "Test function can only handle one capability.");
- is(observed.videoCapabilities[0].contentType, expected.videoCapabilities[0].contentType, name + " videoCapabilities should match.");
- }
- if (expected.sessionTypes) {
- is(expected.sessionTypes.length, observed.sessionTypes.length, "Should have expected number of sessionTypes");
- for (var i = 0; i < expected.sessionTypes.length; i++) {
- is(expected[i], observed[i], "Session type " + i + " should match");
- }
- }
-}
-
-function Test(test) {
- var name = "'" + test.name + "'";
- return new Promise(function(resolve, reject) {
- var p;
- if (test.options) {
- var keySystem = (test.keySystem !== undefined) ? test.keySystem : CLEARKEY_KEYSYSTEM;
- p = navigator.requestMediaKeySystemAccess(keySystem, test.options);
- } else {
- p = navigator.requestMediaKeySystemAccess(keySystem);
- }
- p.then(
- function(keySystemAccess) {
- ok(test.shouldPass, name + " passed and was expected to " + (test.shouldPass ? "pass" : "fail"));
- is(keySystemAccess.keySystem, CLEARKEY_KEYSYSTEM, "CDM keySystem should be in MediaKeySystemAccess.keySystem");
- ValidateConfig(name, test.expectedConfig, keySystemAccess.getConfiguration());
- resolve();
- },
- function(ex) {
- if (test.shouldPass) {
- info(name + " failed: " + ex);
- }
- ok(!test.shouldPass, name + " failed and was expected to " + (test.shouldPass ? "pass" : "fail"));
- resolve();
- });
- });
-}
-
-var tests = [
- {
- name: 'Empty keySystem string',
- keySystem: '',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Empty options specified',
- options: [ ],
- shouldPass: false,
- },
- {
- name: 'Undefined options',
- shouldPass: false,
- },
- {
- name: 'Basic MP4 cenc',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- videoCapabilities: [{contentType: 'video/mp4'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- videoCapabilities: [{contentType: 'video/mp4'}],
- },
- shouldPass: true,
- },
- {
- name: 'Invalid keysystem failure',
- keySystem: 'bogusKeySystem',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Invalid initDataType',
- options: [
- {
- initDataTypes: ['bogus'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Valid initDataType after invalid',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['bogus', 'invalid', 'cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- },
- shouldPass: true,
- },
- {
- name: 'Invalid videoType',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/bogus'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Invalid distinctiveIdentifier fails',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- distinctiveIdentifier: 'bogus',
- persistentState: 'bogus',
- }
- ],
- shouldPass: false,
- },
- {
- name: 'distinctiveIdentifier is prohibited for ClearKey',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- distinctiveIdentifier: 'required',
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Invalid persistentState fails',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- persistentState: 'bogus',
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Invalid robustness unsupported',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4', robustness: 'very much so'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Unexpected config entry should be ignored',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- unexpectedEntry: 'this should be ignored',
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- },
- shouldPass: true,
- },
- {
- name: 'Invalid option followed by valid',
- options: [
- {
- label: "this config should not be supported",
- initDataTypes: ['bogus'],
- },
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- },
- shouldPass: true,
- },
- {
- name: 'Persistent-license should not be supported by ClearKey',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- sessionTypes: ['persistent-license'],
- persistentState: 'optional',
- }
- ],
- shouldPass: false,
- },
- {
- name: 'Persistent-usage-record should not be supported by ClearKey',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4'}],
- sessionTypes: ['persistent-usage-record'],
- persistentState: 'optional',
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 audio container',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4'}],
- },
- shouldPass: true,
- },
- {
- name: 'MP4 audio container with AAC-LC',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="mp4a.40.2"'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="mp4a.40.2"'}],
- },
- shouldPass: true,
- },
- {
- name: 'MP4 audio container with invalid codecs',
- options: [
- {
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="bogus"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 audio container with mp3 is unsupported',
- options: [
- {
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="mp3"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 video container type with an mp3 codec is unsupported',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="mp3"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 audio container type with a video codec is unsupported',
- options: [
- {
- initDataTypes: ['cenc'],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="avc1.42E01E"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 video container with constrained baseline h.264',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E"'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E"'}],
- },
- shouldPass: true,
- },
- {
- name: 'MP4 video container with invalid codecs',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="bogus"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 video container with both audio and video codec type in videoType',
- options: [
- {
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"'}],
- }
- ],
- shouldPass: false,
- },
- {
- name: 'MP4 audio and video type both specified',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E"'}],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="mp4a.40.2"'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['cenc'],
- videoCapabilities: [{contentType: 'video/mp4; codecs="avc1.42E01E"'}],
- audioCapabilities: [{contentType: 'audio/mp4; codecs="mp4a.40.2"'}],
- },
- shouldPass: true,
- },
- {
- name: 'Basic WebM video',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm'}],
- },
- shouldPass: true,
- },
- {
- name: 'Basic WebM audio',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- audioCapabilities: [{contentType: 'audio/webm'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- audioCapabilities: [{contentType: 'audio/webm'}],
- },
- shouldPass: true,
- },
- {
- name: 'Webm with Vorbis audio and VP8 video.',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
- audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
- audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
- },
- shouldPass: true,
- },
- {
- name: 'Webm with Vorbis audio and VP9 video.',
- options: [
- {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm;codecs="vp9"'}],
- audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
- }
- ],
- expectedConfig: {
- label: SUPPORTED_LABEL,
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm;codecs="vp9"'}],
- audioCapabilities: [{contentType: 'audio/webm;codecs="vorbis"'}],
- },
- shouldPass: true,
- },
- {
- name: 'Webm with bogus video.',
- options: [
- {
- initDataTypes: ['webm'],
- videoCapabilities: [{contentType: 'video/webm;codecs="bogus"'}],
- }
- ],
- shouldPass: false,
- },
-];
-
-function beginTest() {
- Promise.all(tests.map(Test)).then(function() { SimpleTest.finish(); });
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_request_notifications.html b/dom/media/test/test_eme_request_notifications.html
deleted file mode 100644
index c2fab5b152..0000000000
--- a/dom/media/test/test_eme_request_notifications.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 SetPrefs(prefs) {
- return new Promise(function(resolve, reject) {
- SpecialPowers.pushPrefEnv({"set": prefs}, function() { resolve(); });
- });
-}
-
-function observe() {
- return new Promise(function(resolve, reject) {
- var observer = function(subject, topic, data) {
- SpecialPowers.Services.obs.removeObserver(observer, "mediakeys-request");
- resolve(JSON.parse(data).status);
- };
- SpecialPowers.Services.obs.addObserver(observer, "mediakeys-request", false);
- });
-}
-
-function Test(test) {
- var p = test.prefs ? SetPrefs(test.prefs) : Promise.resolve();
- observedStatus = "nothing";
- var name = "'" + test.keySystem + "'";
-
- var res = observe().then((status) => {
- is(status, test.expectedStatus, name + " expected status");
- });
-
- p.then(() => navigator.requestMediaKeySystemAccess(test.keySystem, gCencMediaKeySystemConfig))
- .then((keySystemAccess) => keySystemAccess.createMediaKeys());
-
- return res;
-}
-
-const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
-
-var tests = [
- {
- keySystem: CLEARKEY_KEYSYSTEM,
- expectedStatus: 'cdm-created',
- prefs: [["media.eme.enabled", false]]
- },
- {
- keySystem: "com.widevine.alpha",
- expectedStatus: 'api-disabled',
- prefs: [["media.eme.enabled", false]]
- },
- {
- keySystem: "com.widevine.alpha",
- expectedStatus: (isWinXP ? 'cdm-not-supported' : 'cdm-disabled'),
- prefs: [["media.eme.enabled", true], ["media.gmp-widevinecdm.enabled", false]]
- },
- {
- keySystem: "com.widevine.alpha",
- expectedStatus: (isWinXP ? 'cdm-not-supported' : 'cdm-not-installed'),
- prefs: [["media.eme.enabled", true], , ["media.gmp-widevinecdm.enabled", true]]
- },
- {
- keySystem: CLEARKEY_KEYSYSTEM,
- expectedStatus: 'cdm-created',
- prefs: [["media.eme.enabled", true]]
- }
-];
-
-SetupEMEPref(function() {
- tests.reduce(function(p,c,i,array) {
- return p.then(function() { return Test(c); });
- }, Promise.resolve()).then(SimpleTest.finish);
-});
-
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_session_callable_value.html b/dom/media/test/test_eme_session_callable_value.html
deleted file mode 100644
index 5c5f51e307..0000000000
--- a/dom/media/test/test_eme_session_callable_value.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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">
-
-function Test() {
- navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, gCencMediaKeySystemConfig)
- .then(access => access.createMediaKeys())
- .then(mediaKeys => {
- var initData = (new TextEncoder()).encode( 'this is an invalid license, and that is ok');
- var s = mediaKeys.createSession("temporary");
- s.generateRequest("cenc", initData); // ignore result.
- // "update()" call should fail, because MediaKeySession is "not callable"
- // yet, since CDM won't have had a chance to set the sessionId on MediaKeySession.
- return s.update(initData);
- })
- .then(()=>{ok(false, "An exception should be thrown; MediaKeySession should be not callable."); SimpleTest.finish();},
- ()=>{ok(true, "We expect this to fail; MediaKeySession should be not callable."); SimpleTest.finish();});
-}
-
-SimpleTest.waitForExplicitFinish();
-SetupEMEPref(Test);
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_setMediaKeys_before_attach_MediaSource.html b/dom/media/test/test_eme_setMediaKeys_before_attach_MediaSource.html
deleted file mode 100644
index 72bc77124d..0000000000
--- a/dom/media/test/test_eme_setMediaKeys_before_attach_MediaSource.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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">
-
-function beginTest() {
- var video = document.createElement("video");
-
- navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, gCencMediaKeySystemConfig)
- .then(function(keySystemAccess) {
- return keySystemAccess.createMediaKeys();
- })
- .then(mediaKeys => {
- return video.setMediaKeys(mediaKeys);
- })
- .then(() => {
- var ms = new MediaSource();
- ms.addEventListener("sourceopen", ()=>{ok(true, "MediaSource should open"); SimpleTest.finish();});
- video.addEventListener("error", ()=>{ok(false, "Shouldn't error."); SimpleTest.finish();});
- video.src = URL.createObjectURL(ms);
- });
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_stream_capture_blocked_case1.html b/dom/media/test/test_eme_stream_capture_blocked_case1.html
deleted file mode 100644
index 61e8d673f3..0000000000
--- a/dom/media/test/test_eme_stream_capture_blocked_case1.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 startTest(test, token)
-{
- // Three cases:
- // 1. setting MediaKeys on an element captured by MediaElementSource should fail, and
- // 2. creating a MediaElementSource on a media element with a MediaKeys should fail, and
- // 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
-
- // Case 1. setting MediaKeys on an element captured by MediaElementSource should fail.
- var case1token = token + "_case1";
- var setKeysFailed = function() {
- ok(true, TimeStamp(case1token) + " setMediaKeys failed as expected.");
- manager.finished(case1token);
- };
- var v1 = SetupEME(test, case1token, { onSetKeysFail: setKeysFailed });
- var context = new AudioContext();
- var node = context.createMediaElementSource(v1);
- v1.addEventListener("loadeddata", function(ev) {
- ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
- });
- manager.started(case1token);
- LoadTestWithManagedLoadToken(test, v1, manager, case1token,
- { onlyLoadFirstFragments:2, noEndOfStream:false });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_stream_capture_blocked_case2.html b/dom/media/test/test_eme_stream_capture_blocked_case2.html
deleted file mode 100644
index 48c8bf3e4a..0000000000
--- a/dom/media/test/test_eme_stream_capture_blocked_case2.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 startTest(test, token)
-{
- // Three cases:
- // 1. setting MediaKeys on an element captured by MediaElementSource should fail, and
- // 2. creating a MediaElementSource on a media element with a MediaKeys should fail, and
- // 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
-
- // Case 2. creating a MediaElementSource on a media element with a MediaKeys should fail.
- var case2token = token + "_case2";
- var v2 = SetupEME(test, case2token);
- v2.addEventListener("loadeddata", function(ev) {
- ok(true, case2token + " should reach loadeddata");
- var threw = false;
- try {
- var context = new AudioContext();
- var node = context.createMediaElementSource(v2);
- } catch (e) {
- threw = true;
- }
- ok(threw, "Should throw an error creating a MediaElementSource on an EME video.");
- manager.finished(case2token);
- });
- manager.started(case2token);
- LoadTestWithManagedLoadToken(test, v2, manager, case2token,
- { onlyLoadFirstFragments:2, noEndOfStream:false });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_stream_capture_blocked_case3.html b/dom/media/test/test_eme_stream_capture_blocked_case3.html
deleted file mode 100644
index 1af4e0aadf..0000000000
--- a/dom/media/test/test_eme_stream_capture_blocked_case3.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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 startTest(test, token)
-{
- // Three cases:
- // 1. setting MediaKeys on an element captured by MediaElementSource should fail, and
- // 2. creating a MediaElementSource on a media element with a MediaKeys should fail, and
- // 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
-
- // Case 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
- var case3token = token + "_case3";
- var v3 = SetupEME(test, case3token);
- v3.addEventListener("loadeddata", function(ev) {
- ok(true, TimeStamp(case3token) + " should reach loadeddata");
- var threw = false;
- try {
- var stream = v3.mozCaptureStreamUntilEnded();
- } catch (e) {
- threw = true;
- }
- ok(threw, TimeStamp(case3token) + " Should throw an error calling mozCaptureStreamUntilEnded an EME video.");
- manager.finished(case3token);
- });
- manager.started(case3token);
- LoadTestWithManagedLoadToken(test, v3, manager, case3token,
- { onlyLoadFirstFragments:2, noEndOfStream:false });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/media/test/test_eme_waitingforkey.html b/dom/media/test/test_eme_waitingforkey.html
deleted file mode 100644
index ce808342bb..0000000000
--- a/dom/media/test/test_eme_waitingforkey.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test Encrypted Media Extensions</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="http://test1.mochi.test:8888/tests/dom/media/test/eme.js"></script>
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-var manager = new MediaTestManager;
-
-function startTest(test, token)
-{
- // Test if the appropriate preconditions are met such that we can start
- // prcoessing delayed sessions.
- function TestIfDoneDelaying()
- {
- var got = "Got:";
- if (loaded) { got += " loaded,"; }
- got += " " + gotEncrypted + "/" + test.sessionCount + " sessions,";
- got += " " + gotWaitingForKey + " waiting for key events"
- if (loaded && gotEncrypted == test.sessionCount && gotWaitingForKey > 0) {
- Log(token, got + " -> Update sessions with keys");
- params.ProcessSessions();
- } else {
- Log(token, got + " -> Wait for more...");
- }
- }
-
- manager.started(token);
-
- var updatedSessionsCount = 0;
- var loaded = false;
-
- var params = {
- // params will be populated with a ProcessSessions() callback, that can be
- // called to process delayed sessions.
- delaySessions: true,
- // Function to be called once we start processing and updating sessions.
- // This should only be called once the preconditions in TestIfDoneDealying
- // are met.
- onsessionupdated: function(session) {
- updatedSessionsCount += 1;
- if (updatedSessionsCount == test.sessionCount) {
- info(TimeStamp(token) + " Updated all sessions, loading complete -> Play");
- v.play();
- } else {
- info(TimeStamp(token) + " Updated " + updatedSessionsCount + "/" + test.sessionCount + " sessions so far");
- }
- },
- };
- var v = SetupEME(test, token, params);
-
- document.body.appendChild(v);
-
- var gotEncrypted = 0;
- var gotWaitingForKey = 0;
- var gotOnwaitingforkey = 0;
-
- v.addEventListener("encrypted", function() {
- gotEncrypted += 1;
- TestIfDoneDelaying();
- });
-
- v.addEventListener("waitingforkey", function() {
- gotWaitingForKey += 1;
- TestIfDoneDelaying()
- });
-
- v.onwaitingforkey = function() {
- gotOnwaitingforkey += 1;
- };
-
- v.addEventListener("loadedmetadata", function() {
- ok(SpecialPowers.do_lookupGetter(v, "isEncrypted").apply(v),
- TimeStamp(token) + " isEncrypted should be true");
- is(v.isEncrypted, undefined, "isEncrypted should not be accessible from content");
- });
-
- v.addEventListener("ended", function() {
- ok(true, TimeStamp(token) + " got ended event");
- // We expect only one waitingForKey as we delay until all sessions are ready.
- // I.e. one waitingForKey should be fired, after which, we process all sessions,
- // so it should not be possible to be blocked by a key after that point.
- ok(gotWaitingForKey == 1, "Expected number 1 wait, got: " + gotWaitingForKey);
- ok(gotOnwaitingforkey == gotWaitingForKey, "Should have as many event listener calls as event handler calls, got: " + gotOnwaitingforkey);
-
- v.closeSessions().then(() => manager.finished(token));
- });
-
- LoadTest(test, v, token)
- .then(function() {
- loaded = true;
- TestIfDoneDelaying();
- }).catch(function() {
- ok(false, token + " failed to load");
- manager.finished(token);
- });
-}
-
-function beginTest() {
- manager.runTests(gEMETests, startTest);
-}
-
-if (!IsMacOSSnowLeopardOrEarlier()) {
- SimpleTest.waitForExplicitFinish();
- SetupEMEPref(beginTest);
-} else {
- todo(false, "Test disabled on this platform.");
-}
-</script>
-</pre>
-</body>
-</html>