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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-utils.js

Issue 806653004: Revert "Remove MediaKeys.isTypeSupported()." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 var console = null; 1 var console = null;
2 2
3 function consoleWrite(text) 3 function consoleWrite(text)
4 { 4 {
5 if (!console && document.body) { 5 if (!console && document.body) {
6 console = document.createElement('div'); 6 console = document.createElement('div');
7 document.body.appendChild(console); 7 document.body.appendChild(console);
8 } 8 }
9 var span = document.createElement('span'); 9 var span = document.createElement('span');
10 span.appendChild(document.createTextNode(text)); 10 span.appendChild(document.createTextNode(text));
11 span.appendChild(document.createElement('br')); 11 span.appendChild(document.createElement('br'));
12 console.appendChild(span); 12 console.appendChild(span);
13 } 13 }
14 14
15 // FIXME: Detect EME support rather than just general container support.
16 // http://crbug.com/441585
17 // For now, assume that implementations that support a container type for clear
18 // content and are running these tests also support that container with EME.
19 // Because this code creates an ActiveDOMObject, which could break the lifetime
20 // tests, we must run it before the actual tests run and save the results for
21 // use in the tests.
22 var element = new Audio();
23 var isWebMSupported = ('' != element.canPlayType('video/webm'));
24 var isCencSupported = ('' != element.canPlayType('video/mp4'));
25 // Force the ActiveDOMObject to be deleted before the tests run.
26 element = null;
27 asyncGC();
28
29 function isInitDataTypeSupported(initDataType)
30 {
31 var result = false;
32 switch (initDataType) {
33 case 'webm':
34 result = isWebMSupported;
35 break;
36 case 'cenc':
37 result = isCencSupported;
38 break;
39 default:
40 result = false;
41 }
42
43 return result;
44 }
45
46
47 function getInitDataType() 15 function getInitDataType()
48 { 16 {
49 if (isInitDataTypeSupported('webm')) 17 return (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm')) ? 'webm' : 'cenc';
50 return 'webm';
51 if (isInitDataTypeSupported('cenc'))
52 return 'cenc';
53 throw 'No supported Initialization Data Types';
54 } 18 }
55 19
56 function getInitData(initDataType) 20 function getInitData(initDataType)
57 { 21 {
58 // FIXME: This should be dependent on initDataType. 22 // FIXME: This should be dependent on initDataType.
59 return new Uint8Array([ 0, 1, 2, 3, 4, 5, 6, 7 ]); 23 return new Uint8Array([ 0, 1, 2, 3, 4, 5, 6, 7 ]);
60 } 24 }
61 25
62 function waitForEventAndRunStep(eventName, element, func, stepTest) 26 function waitForEventAndRunStep(eventName, element, func, stepTest)
63 { 27 {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return stringToUint8Array(decoded_key); 137 return stringToUint8Array(decoded_key);
174 } 138 }
175 catch (o) { 139 catch (o) {
176 // Not valid JSON, so return message untouched as Uint8Array. 140 // Not valid JSON, so return message untouched as Uint8Array.
177 // This is for backwards compatibility. 141 // This is for backwards compatibility.
178 // FIXME: Remove this once the code is switched to return JSON all 142 // FIXME: Remove this once the code is switched to return JSON all
179 // the time. 143 // the time.
180 return new Uint8Array(message); 144 return new Uint8Array(message);
181 } 145 }
182 } 146 }
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/media/encrypted-media/encrypted-media-v2-syntax.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698