| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Verify v2 events</title> | 4 <title>Verify v2 events</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 // Currently Clear Key only generates aynchronous "message" events. | 12 // Currently Clear Key only generates aynchronous "message" events. |
| 13 // It does not generate any "error" events. | 13 // It does not generate any "error" events. |
| 14 // FIXME: Update this test to handle "keychange" events once | 14 // FIXME: Update this test to handle "keychange" events once |
| 15 // implemented. | 15 // implemented. |
| 16 async_test(function(test) | 16 async_test(function(test) |
| 17 { | 17 { |
| 18 var mediaKeySession; | 18 var mediaKeySession; |
| 19 | 19 |
| 20 function processMessage(event) | 20 function processMessage(event) |
| 21 { | 21 { |
| 22 test.done(); | 22 test.done(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 MediaKeys.create('org.w3.clearkey').then(test.step_func(function
(mediaKeys) { | 25 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
| 26 return access.createMediaKeys(); |
| 27 }).then(test.step_func(function(mediaKeys) { |
| 26 var initDataType = getInitDataType(); | 28 var initDataType = getInitDataType(); |
| 27 var mediaKeySession = mediaKeys.createSession(); | 29 var mediaKeySession = mediaKeys.createSession(); |
| 28 waitForEventAndRunStep('message', mediaKeySession, test.step
_func(processMessage), test); | 30 waitForEventAndRunStep('message', mediaKeySession, test.step
_func(processMessage), test); |
| 29 return mediaKeySession.generateRequest(initDataType, getInit
Data(initDataType)); | 31 return mediaKeySession.generateRequest(initDataType, getInit
Data(initDataType)); |
| 30 })).catch(test.step_func(function(error) { | 32 })).catch(test.step_func(function(error) { |
| 31 forceTestFailureFromPromise(test, error); | 33 forceTestFailureFromPromise(test, error); |
| 32 })); | 34 })); |
| 33 }, 'Verify v2 events.'); | 35 }, 'Verify v2 events.'); |
| 34 </script> | 36 </script> |
| 35 </body> | 37 </body> |
| 36 </html> | 38 </html> |
| OLD | NEW |