Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<title>Media Engine only test : key rotation through seig sample groups with WMFClearKey</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="https://example.com:443/tests/dom/media/test/eme.js"></script>
<script type="text/javascript" src="seig_key_rotation.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from seig_key_rotation.js */
SimpleTest.requestLongerTimeout(2);
add_task(async function setupTestingPrefs() {
await SpecialPowers.pushPrefEnv({
set: [
["media.wmf.media-engine.enabled", 2],
["media.wmf.media-engine.channel-decoder.enabled", true],
["media.eme.wmf.clearkey.enabled", true],
["media.wmf.media-engine.bypass-gfx-blocklist", true],
["media.eme.mfcdm.origin-filter.enabled", false],
// The media engine's DComp/frame-server path conflicts with the Windows
// App SDK in test environments.
["widget.windows.windowsappsdk.enabled", false],
],
});
});
// WMFClearKey keeps every key it receives for the lifetime of its process, so
// the cases without key B run before any case provides it.
for (const fixture of kSeigFixtures) {
add_task(async function stopWithoutRotatedKey() {
info(`${fixture.scheme}: key B is never provisioned`);
const { video, firstEvent } = await startSeigRotationPlayback(
fixture, { [kSeigKeyIdA]: kSeigKeys[kSeigKeyIdA] },
["waitingforkey", "ended", "error"]);
// Samples after the rotation need KID B. WMFClearKey fails to decrypt a
// sample whose key is missing instead of waiting for it, so either event
// shows that the rotated KID was used.
isnot(await firstEvent, "ended",
"Playback does not pass the rotation without key B");
ok(video.currentTime < kSeigRotationTime,
`Stopped before the rotation point (currentTime=${video.currentTime})`);
removeSeigVideo(video);
});
}
for (const fixture of kSeigFixtures) {
add_task(async function playWithBothKeys() {
info(`${fixture.scheme}: both keys are provisioned`);
const { video, firstEvent } = await startSeigRotationPlayback(
fixture, kSeigKeys, ["ended", "error"]);
is(await firstEvent, "ended", "Playback reaches the end");
removeSeigVideo(video);
});
}
</script>
</pre>
</body>
</html>