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

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

Issue 16387015: Make unprefixed EME APIs use platform and Chromium. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: KURL.h moved Created 7 years, 6 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 | Annotate | Revision Log
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 18
19 function runTest() 19 function runTest()
20 { 20 {
21 // Initialize the MockCDM. It supports the key system 'com.apple .mock', the
22 // mime type 'video/mock'. It requires init data to begin with ' mock', and
23 // keys to begin with 'key'.
24 if (internals)
25 internals.initializeMockCDM();
26
27 consoleWrite("Test MediaKeys."); 21 consoleWrite("Test MediaKeys.");
28 testExpected('typeof window.MediaKeys', 'function'); 22 testExpected('typeof window.MediaKeys', 'function');
29 testDOMException('new MediaKeys("")', "DOMException.INVALID_ACCE SS_ERR"); 23 testDOMException('new MediaKeys("")', "DOMException.INVALID_ACCE SS_ERR");
30 testDOMException('new MediaKeys("unsupported")', "DOMException.N OT_SUPPORTED_ERR"); 24 testDOMException('new MediaKeys("unsupported")', "DOMException.N OT_SUPPORTED_ERR");
31 run('mediaKeys = new MediaKeys("com.webcore.mock")'); 25 run('mediaKeys = new MediaKeys("org.w3.clearkey")');
32 testExpected('typeof mediaKeys', 'object'); 26 testExpected('typeof mediaKeys', 'object');
33 testExpected('mediaKeys.keySystem', 'com.webcore.mock'); 27 testExpected('mediaKeys.keySystem', 'org.w3.clearkey');
34 testExpected('typeof mediaKeys.createSession', 'function'); 28 testExpected('typeof mediaKeys.createSession', 'function');
35 testDOMException('mediaKeys.createSession("", new Uint8Array(1)) ', "DOMException.INVALID_ACCESS_ERR"); 29 testDOMException('mediaKeys.createSession("", new Uint8Array(1)) ', "DOMException.INVALID_ACCESS_ERR");
36 testDOMException('mediaKeys.createSession("unsupported/type")', "DOMException.NOT_SUPPORTED_ERR"); 30 testDOMException('mediaKeys.createSession("unsupported/type")', "DOMException.NOT_SUPPORTED_ERR");
37 consoleWrite(""); 31 consoleWrite("");
38 32
39 consoleWrite("Test MediaKeySession."); 33 consoleWrite("Test MediaKeySession.");
40 run('mediaKeySession = mediaKeys.createSession("video/mock", ini tData)'); 34 run('mediaKeySession = mediaKeys.createSession("video/webm", ini tData)');
41 testExpected('typeof mediaKeySession', 'object'); 35 testExpected('typeof mediaKeySession', 'object');
42 testExpected('typeof mediaKeySession.addEventListener', 'functio n'); 36 testExpected('typeof mediaKeySession.addEventListener', 'functio n');
43 testExpected('typeof mediaKeySession.update', 'function'); 37 testExpected('typeof mediaKeySession.update', 'function');
44 testExpected('mediaKeySession.error', null); 38 testExpected('mediaKeySession.error', null);
45 testExpected('mediaKeySession.keySystem', 'com.webcore.mock'); 39 testExpected('mediaKeySession.keySystem', 'org.w3.clearkey');
46 testExpected('mediaKeySession.sessionId', null, '!='); 40 testExpected('mediaKeySession.sessionId', null, '!=');
47 testExpected('mediaKeySession.onwebkitkeyadded', null); 41 testExpected('mediaKeySession.onwebkitkeyadded', null);
48 testExpected('mediaKeySession.onwebkitkeyerror', null); 42 testExpected('mediaKeySession.onwebkitkeyerror', null);
49 testExpected('mediaKeySession.onwebkitkeymessage', null); 43 testExpected('mediaKeySession.onwebkitkeymessage', null);
50 testDOMException('mediaKeySession.update(null)', "DOMException.I NVALID_ACCESS_ERR"); 44 testDOMException('mediaKeySession.update(null)', "DOMException.I NVALID_ACCESS_ERR");
51 endTest(); 45 endTest();
52 } 46 }
53 </script> 47 </script>
54 </head> 48 </head>
55 <body onload="runTest()"> 49 <body onload="runTest()">
56 <p>This tests the basic API of MediaKeys and MediaKeySession.</p> 50 <p>This tests the basic API of MediaKeys and MediaKeySession.</p>
57 </body> 51 </body>
58 </html> 52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698