Bug 1711912 - Add test case to ensure special key systems are only available if preffed on. r=alwu

Differential Revision: https://phabricator.services.mozilla.com/D122634
This commit is contained in:
Bryce Seager van Dyk 2021-08-18 18:38:16 +00:00
Родитель d015a6fef8
Коммит 15986aca3d
2 изменённых файлов: 47 добавлений и 0 удалений

Просмотреть файл

@ -861,6 +861,9 @@ scheme=https
[test_eme_setMediaKeys_before_attach_MediaSource.html] [test_eme_setMediaKeys_before_attach_MediaSource.html]
skip-if = toolkit == 'android' # bug 1149374 skip-if = toolkit == 'android' # bug 1149374
scheme=https scheme=https
[test_eme_special_key_system.html]
skip-if = toolkit == 'android' # bug 1149374
scheme=https
[test_eme_stream_capture_blocked_case1.html] [test_eme_stream_capture_blocked_case1.html]
tags=mtg capturestream tags=mtg capturestream
skip-if = toolkit == 'android' # bug 1149374 skip-if = toolkit == 'android' # bug 1149374

Просмотреть файл

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>Test Encrypted Media Extensions - Special key system</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
// Tests that org.mozilla.clearkey_with_protection_query cannot be accessed from JS if not preffed on.
add_task(async function protectionQueryKeySystemShouldBeHidden() {
const kKeySystemOptions = [
{
initDataTypes: ["cenc"],
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.4d4015"' }],
},
];
const kClearKeyWithProtectionQuery =
"org.mozilla.clearkey_with_protection_query";
try {
// Should throw since special key systems are not enabled.
await navigator.requestMediaKeySystemAccess(
kClearKeyWithProtectionQuery,
kKeySystemOptions
);
ok(
false,
"Test should have thrown by default because media.clearkey.test-key-systems.enabled should not be set"
);
} catch (e) {
is(e.name, "NotSupportedError", "Should get not supported error");
is(
e.message,
"Key system is unsupported",
"Should get message that key system is unsupported"
);
}
});
</script>
</pre>
</body>
</html>