blob: ba95314ed22c71a740e17375407e5abe6c4492c4 [file] [log] [blame]
jer.noble@apple.com01c84b82014-03-14 20:45:42 +00001<!DOCTYPE html>
2<html>
3 <head>
4 <title>WebKitMediaKeys</title>
5 <script src=../video-test.js></script>
6 <script src=../../resources/gc.js></script>
7 <script>
8 function stringToUint8Array(str)
9 {
10 var arr=[];
11 for(var i=0,j=str.length;i<j;++i)
12 arr[i]=str.charCodeAt(i);
13 return new Uint8Array(arr);
14 }
15
16 var mediaKeys;
17 var mediaKeySession;
18 var initData = stringToUint8Array('mock');
19
20 function runTest()
21 {
22 // Initialize the MockCDM. It supports the key system 'com.apple.mock', the
23 // mime type 'video/mock'. It requires init data to begin with 'mock', and
24 // keys to begin with 'key'.
25 if (internals)
26 internals.initializeMockCDM();
27
28 run('mediaKeys = new WebKitMediaKeys("com.webcore.mock")');
29 run('mediaKeySession = mediaKeys.createSession("video/mock", initData)');
30 run('delete mediaKeySession');
31 run('gc()');
32 waitForEvent('webkitkeymessage', null, true, false, mediaKeySession);
33 }
34
35 </script>
36 </head>
37 <body onload="runTest()">
38 <p>This tests that the MediaKeySession object is not garbage collected when associated with an open mediaKeys object.</p>
39 </body>
40</html>