Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-v2-events.html

Issue 124253003: Update MediaKeySession events to match latest EME spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename javascript Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>MediaKeys</title> 4 <title>MediaKeys</title>
5 <script src=../video-test.js></script> 5 <script src=../video-test.js></script>
6 <script> 6 <script>
7 function stringToUint8Array(str) 7 function stringToUint8Array(str)
8 { 8 {
9 var arr=[]; 9 var arr=[];
10 for(var i=0,j=str.length;i<j;++i) 10 for(var i=0,j=str.length;i<j;++i)
11 arr[i]=str.charCodeAt(i); 11 arr[i]=str.charCodeAt(i);
12 return new Uint8Array(arr); 12 return new Uint8Array(arr);
13 } 13 }
14 14
15 var mediaKeys; 15 var mediaKeys;
16 var mediaKeySession; 16 var mediaKeySession;
17 var initData = stringToUint8Array('mock'); 17 var initData = stringToUint8Array('mock');
18 var invalidKey = stringToUint8Array('invalid'); 18 var invalidKey = stringToUint8Array('invalid');
19 var validKey = stringToUint8Array( 19 var validKey = stringToUint8Array(
20 '{"keys":[{"kty":"oct","kid":"AAECAw","k":"MTIzNDU2Nzg5MGFiY2RlZ g"}]}'); 20 '{"keys":[{"kty":"oct","kid":"AAECAw","k":"MTIzNDU2Nzg5MGFiY2RlZ g"}]}');
21 21
22 function runTest() 22 function runTest()
23 { 23 {
24 run('mediaKeys = new MediaKeys("org.w3.clearkey")'); 24 run('mediaKeys = new MediaKeys("org.w3.clearkey")');
25 run('mediaKeySession = mediaKeys.createSession("video/webm", ini tData)'); 25 run('mediaKeySession = mediaKeys.createSession("video/webm", ini tData)');
26 waitForEvent('webkitkeymessage', keyMessage, false, false, media KeySession); 26 waitForEvent('message', processMessage, false, false, mediaKeySe ssion);
27 waitForEvent('webkitkeyerror', keyError, false, false, mediaKeyS ession); 27 waitForEvent('error', processError, false, false, mediaKeySessio n);
28 waitForEvent('webkitkeyadded', null, true, false, mediaKeySessio n); 28 waitForEvent('ready', null, true, false, mediaKeySession);
29 } 29 }
30 30
31 function keyMessage(event) 31 function processMessage(event)
32 { 32 {
33 run('mediaKeySession.update(invalidKey)'); 33 run('mediaKeySession.update(invalidKey)');
34 } 34 }
35 35
36 function keyError(event) 36 function processError(event)
37 { 37 {
38 run('mediaKeySession.update(validKey)'); 38 run('mediaKeySession.update(validKey)');
39 } 39 }
40 </script> 40 </script>
41 </head> 41 </head>
42 <body onload="runTest()"> 42 <body onload="runTest()">
43 <p>This tests the events created by MediaKeys.</p> 43 <p>This tests the events created by MediaKeys.</p>
44 </body> 44 </body>
45 </html> 45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698