test_eme_output_config_check.html (2361B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>MediaKeySystemConfiguration persistentState and distinctiveIdentifier check</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 <script type="text/javascript" src="manifest.js"></script> 8 </head> 9 <script type="application/javascript"> 10 11 /** 12 * This test verifies that the persistentState and distinctiveIdentifier are 13 * correctly set in the output configuration, and that they remain consistent 14 * between the output configs for MediaKeySystemAccess and MediaCapabilities. 15 */ 16 add_task(async function testConfigResults() { 17 const keySystem = "org.w3.clearkey"; 18 const contentType = 'video/mp4; codecs="avc1.42e01e"'; 19 const mksa = await navigator.requestMediaKeySystemAccess(keySystem, [{ 20 persistentState: 'required', 21 // Clearkey doesn't support 'required' 22 distinctiveIdentifier: 'not-allowed', 23 videoCapabilities: [{ 24 contentType 25 }], 26 }]); 27 is(mksa.getConfiguration().persistentState, 'required', 28 `${mksa.getConfiguration().persistentState} should be "required"`); 29 is(mksa.getConfiguration().distinctiveIdentifier, 'not-allowed', 30 `${mksa.getConfiguration().distinctiveIdentifier} should be "not-allowed"`); 31 32 const info = await navigator.mediaCapabilities.decodingInfo({ 33 type: 'media-source', 34 video: { 35 width: 1280, 36 height: 720, 37 framerate: 30, 38 bitrate: 10000, 39 contentType 40 }, 41 keySystemConfiguration: { 42 keySystem, 43 persistentState: 'required', 44 // Clearkey doesn't support 'required' 45 distinctiveIdentifier: 'not-allowed', 46 }, 47 }); 48 is(info.keySystemAccess.getConfiguration().persistentState, 'required', 49 `${info.keySystemAccess.getConfiguration().persistentState} should be "required"`); 50 is(info.keySystemAccess.getConfiguration().distinctiveIdentifier, 'not-allowed', 51 `${info.keySystemAccess.getConfiguration().distinctiveIdentifier} should be "not-allowed"`); 52 53 is(mksa.getConfiguration().persistentState, 54 info.keySystemAccess.getConfiguration().persistentState, 55 "They should be both 'required'"); 56 is(mksa.getConfiguration().distinctiveIdentifier, 57 info.keySystemAccess.getConfiguration().distinctiveIdentifier, 58 "They should be both 'not-allowed'"); 59 }); 60 61 62 </script> 63 <body> 64 </body> 65 </html>