diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/media/test/test_eme_wv_privacy.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream/115.8.0esr.tar.xz firefox-esr-upstream/115.8.0esr.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_eme_wv_privacy.html')
-rw-r--r-- | dom/media/test/test_eme_wv_privacy.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/dom/media/test/test_eme_wv_privacy.html b/dom/media/test/test_eme_wv_privacy.html new file mode 100644 index 0000000000..a050d2a528 --- /dev/null +++ b/dom/media/test/test_eme_wv_privacy.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test generating encrypted request in Widevine privacy mode</title> + <script 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() { + return new Promise(function(resolve, reject) { + var configs = [{ + initDataTypes: ['keyids'], + videoCapabilities: [{contentType: 'video/mp4' }], + }]; + navigator.requestMediaKeySystemAccess('com.widevine.alpha', configs) + .then((access) => access.createMediaKeys(), + (e) => { throw e; }) + .then((mediaKeys) => { + var session = mediaKeys.createSession('temporary'); + session.addEventListener('message', event => { + is(event.messageType, 'license-request', + 'MediaKeyMessage type should be license-request.'); + const request = new Uint8Array(event.message); + info('request generated[' + request.length + ']: [' + request + ']'); + ok(request.length == 2 && request[0] == 0x08 && request[1] == 0x04, + 'Widevine license request should be [0x08, 0x04] in privacy mode'); + session.close().then(() => { resolve(); }); + }); + return session.generateRequest('keyids', + new TextEncoder().encode('{"kids":["MDAwMDAwMDAwMDAwMDAwMQ=="]}')); + }, + (e) => { throw e; }) + .catch((e) => { + is(e.name, 'NotSupportedError', + 'Should only be rejected when "not supported"'); + resolve(); + }); + }); +} + +SimpleTest.waitForExplicitFinish(); +Test().then(function() { + SimpleTest.finish(); +}); +</script> +</pre> +</body> +</html> |