diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/test/test_eme_getstatusforpolicy.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_eme_getstatusforpolicy.html')
-rw-r--r-- | dom/media/test/test_eme_getstatusforpolicy.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/media/test/test_eme_getstatusforpolicy.html b/dom/media/test/test_eme_getstatusforpolicy.html new file mode 100644 index 0000000000..2993dac7a6 --- /dev/null +++ b/dom/media/test/test_eme_getstatusforpolicy.html @@ -0,0 +1,55 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test Encrypted Media Extensions</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"> +<video id="v" controls></video> +<script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +function createMediaKeysAndSet() { + return navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, gCencMediaKeySystemConfig) + .then(function (access) { + return access.createMediaKeys(); + }) + .then(function (mediaKeys) { + document.getElementById("v").setMediaKeys(mediaKeys); + return mediaKeys; + }); +} + +function test() { + createMediaKeysAndSet() + .then((m) => { + let video = document.getElementById("v"); + is(video.mediaKeys, m, "Should have set MediaKeys on media element"); + // getStatusForPolicy() is not suppored by ClearKey key system. + // The promise will always be rejected with NotSupportedError. + return video.mediaKeys.getStatusForPolicy({minHdcpVersion: "hdcp-2.0"}); + }) + .then((mediaKeyStatus) => { + ok(false, "Promise of getStatusForPolicy should not be resolved with clearkey key system"); + }) + // Promise rejected with NotSupportedError as expected. + .catch(reason => is("NotSupportedError", reason.name, + "Promise should be rejected with NotSupportedError.")) + .then(() => SimpleTest.finish()); +} + +SpecialPowers.pushPrefEnv({"set": + [ + ["media.eme.hdcp-policy-check.enabled", true], + ] + }, test); + +</script> +</pre> +</body> +</html>
\ No newline at end of file |