drm-events.https.html (2617B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset=utf-8> 5 <meta name="timeout" content="long"> 6 <title>Encrypted Media Extensions: Events with DRM</title> 7 <link rel="help" href="https://w3c.github.io/encrypted-media/"> 8 9 <!-- Web Platform Test Harness scripts --> 10 <script src=/resources/testharness.js></script> 11 <script src=/resources/testharnessreport.js></script> 12 13 <!-- Helper scripts for Encrypted Media Extensions tests --> 14 <script src=/encrypted-media/util/utils.js></script> 15 <script src=/encrypted-media/util/utf8.js></script> 16 <script src=/encrypted-media/util/testmediasource.js></script> 17 18 <!-- Content metadata --> 19 <script src=/encrypted-media/content/content-metadata.js></script> 20 21 <!-- Message handler for DRM servers --> 22 <script src=/encrypted-media/util/drm-messagehandler.js></script> 23 24 <!-- The script for this specific test --> 25 <script src=/encrypted-media/scripts/events.js></script> 26 27 </head> 28 <body> 29 <div id='log'></div> 30 31 <script> 32 var keysystem = getSupportedKeySystem(); 33 34 getSupportedContentAndInitDataTypes( keysystem ) 35 .then( function( supported ) 36 { 37 // This test requires initData for supported content. 38 // We prefer explciit initData configured for the content, but 39 // otherwise we will generate initData for a supported initDataType 40 // FIXME: Move me to a utility function 41 var content, 42 initDataType, 43 initData; 44 45 var contentWithExplicitInitData = supported.filter( function( s ) { return s.content.keys && s.content.initDataType; } ); 46 if ( contentWithExplicitInitData.length > 0 ) 47 { 48 content = contentWithExplicitInitData[ 0 ].content; 49 initDataType = content.keys[ 0 ].initDataType; 50 initData = base64DecodeToUnit8Array( content.keys[ 0 ].initData ); 51 } 52 else 53 { 54 content = supported[ 0 ].content; 55 initDataType = supported[ 0 ].initDataTypes[ 0 ]; 56 initData = getInitData( content, initDataType ); 57 } 58 59 var handler = new MessageHandler( keysystem, content ); 60 61 runTest( { keysystem: keysystem, 62 content: content, 63 messagehandler: handler.messagehandler, 64 initDataType: initDataType, 65 initData: initData 66 } ); 67 } ); 68 69 </script> 70 </body> 71 </html>