tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c57c6e1331ef18b75dd37a9f2508d0bc1c93a8cc
parent 5726c193e02800ed79744493ddba47984ea84419
Author: alwu <alwu@mozilla.com>
Date:   Wed, 22 Oct 2025 21:58:03 +0000

Bug 1990159 - part2 : add test. r=media-playback-reviewers,chunmin

Differential Revision: https://phabricator.services.mozilla.com/D268474

Diffstat:
Mdom/media/test/mochitest_eme.toml | 4++++
Adom/media/test/test_eme_output_config_check.html | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/dom/media/test/mochitest_eme.toml b/dom/media/test/mochitest_eme.toml @@ -724,6 +724,10 @@ scheme = "https" skip-if = ["os == 'android'"] # bug 1149374 scheme = "https" +["test_eme_output_config_check.html"] +skip-if = ["os == 'android'"] # bug 1900626 : no clearkey on Android +scheme = "https" + ["test_eme_playback.html"] skip-if = [ "os == 'android'", # bug 1149374 diff --git a/dom/media/test/test_eme_output_config_check.html b/dom/media/test/test_eme_output_config_check.html @@ -0,0 +1,65 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>MediaKeySystemConfiguration persistentState and distinctiveIdentifier check</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> +</head> +<script type="application/javascript"> + +/** + * This test verifies that the persistentState and distinctiveIdentifier are + * correctly set in the output configuration, and that they remain consistent + * between the output configs for MediaKeySystemAccess and MediaCapabilities. + */ +add_task(async function testConfigResults() { + const keySystem = "org.w3.clearkey"; + const contentType = 'video/mp4; codecs="avc1.42e01e"'; + const mksa = await navigator.requestMediaKeySystemAccess(keySystem, [{ + persistentState: 'required', + // Clearkey doesn't support 'required' + distinctiveIdentifier: 'not-allowed', + videoCapabilities: [{ + contentType + }], + }]); + is(mksa.getConfiguration().persistentState, 'required', + `${mksa.getConfiguration().persistentState} should be "required"`); + is(mksa.getConfiguration().distinctiveIdentifier, 'not-allowed', + `${mksa.getConfiguration().distinctiveIdentifier} should be "not-allowed"`); + + const info = await navigator.mediaCapabilities.decodingInfo({ + type: 'media-source', + video: { + width: 1280, + height: 720, + framerate: 30, + bitrate: 10000, + contentType + }, + keySystemConfiguration: { + keySystem, + persistentState: 'required', + // Clearkey doesn't support 'required' + distinctiveIdentifier: 'not-allowed', + }, + }); + is(info.keySystemAccess.getConfiguration().persistentState, 'required', + `${info.keySystemAccess.getConfiguration().persistentState} should be "required"`); + is(info.keySystemAccess.getConfiguration().distinctiveIdentifier, 'not-allowed', + `${info.keySystemAccess.getConfiguration().distinctiveIdentifier} should be "not-allowed"`); + + is(mksa.getConfiguration().persistentState, + info.keySystemAccess.getConfiguration().persistentState, + "They should be both 'required'"); + is(mksa.getConfiguration().distinctiveIdentifier, + info.keySystemAccess.getConfiguration().distinctiveIdentifier, + "They should be both 'not-allowed'"); +}); + + +</script> +<body> +</body> +</html>