| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test support of different initDataTypes.</title> | 4 <title>Test support of different initDataTypes.</title> |
| 5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
| 6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| 11 <script> | 11 <script> |
| 12 function checkInitDataType(initDataType) | 12 function checkInitDataType(initDataType) |
| 13 { | 13 { |
| 14 return isInitDataTypeSupported(initDataType).then(function(resul
t) { | 14 return isInitDataTypeSupported(initDataType).then(function(resul
t) { |
| 15 // If |initDataType| is not supported, simply succeed. | 15 // If |initDataType| is not supported, simply succeed. |
| 16 if (!result) | 16 if (!result) |
| 17 return Promise.resolve('Not supported'); | 17 return Promise.resolve('Not supported'); |
| 18 | 18 |
| 19 var options = [ { initDataTypes: [initDataType] } ]; | 19 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', getSimpleConfigurationForInitDataType(initDataType)) |
| 20 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', options) | |
| 21 .then(function(access) { | 20 .then(function(access) { |
| 22 return access.createMediaKeys(); | 21 return access.createMediaKeys(); |
| 23 }).then(function(mediaKeys) { | 22 }).then(function(mediaKeys) { |
| 24 var mediaKeySession = mediaKeys.createSession(); | 23 var mediaKeySession = mediaKeys.createSession(); |
| 25 var initData = getInitData(initDataType); | 24 var initData = getInitData(initDataType); |
| 26 return mediaKeySession.generateRequest(initDataType,
initData); | 25 return mediaKeySession.generateRequest(initDataType,
initData); |
| 27 }); | 26 }); |
| 28 }); | 27 }); |
| 29 } | 28 } |
| 30 | 29 |
| 31 promise_test(function() | 30 promise_test(function() |
| 32 { | 31 { |
| 33 return checkInitDataType('webm'); | 32 return checkInitDataType('webm'); |
| 34 }, 'Clear key support for "webm".'); | 33 }, 'Clear key support for "webm".'); |
| 35 | 34 |
| 36 promise_test(function() | 35 promise_test(function() |
| 37 { | 36 { |
| 38 return checkInitDataType('cenc'); | 37 return checkInitDataType('cenc'); |
| 39 }, 'Clear key support for "cenc".'); | 38 }, 'Clear key support for "cenc".'); |
| 40 | 39 |
| 41 promise_test(function() | 40 promise_test(function() |
| 42 { | 41 { |
| 43 return checkInitDataType('keyids'); | 42 return checkInitDataType('keyids'); |
| 44 }, 'Clear key support for "keyids".'); | 43 }, 'Clear key support for "keyids".'); |
| 45 </script> | 44 </script> |
| 46 </body> | 45 </body> |
| 47 </html> | 46 </html> |
| 48 | 47 |
| OLD | NEW |