| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test multiple MediaKeys lifetimes</title> | 4 <title>Test multiple MediaKeys lifetimes</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> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Create a MediaKeys object and an associated MediaKeySession | 41 // Create a MediaKeys object and an associated MediaKeySession |
| 42 // object. |mediaKeys| is updated to refer to the new MediaKeys | 42 // object. |mediaKeys| is updated to refer to the new MediaKeys |
| 43 // object. Returns a promise that resolves with the new | 43 // object. Returns a promise that resolves with the new |
| 44 // MediaKeySession object. | 44 // MediaKeySession object. |
| 45 function createMediaKeyWithMediaKeySession() | 45 function createMediaKeyWithMediaKeySession() |
| 46 { | 46 { |
| 47 return MediaKeys.create('org.w3.clearkey').then(function(res
ult) { | 47 return MediaKeys.create('org.w3.clearkey').then(function(res
ult) { |
| 48 mediaKeys = result; | 48 mediaKeys = result; |
| 49 return mediaKeys.createSession(initDataType, initData); | 49 var mediaKeySession = mediaKeys.createSession(); |
| 50 return mediaKeySession.generateRequest(initDataType, ini
tData).then(function() { |
| 51 return mediaKeySession; |
| 52 }); |
| 50 }); | 53 }); |
| 51 } | 54 } |
| 52 | 55 |
| 53 // Create a few MediaKeys + MediaKeySession objects. Only keep | 56 // Create a few MediaKeys + MediaKeySession objects. Only keep |
| 54 // a reference to the last one created. | 57 // a reference to the last one created. |
| 55 createMediaKeyWithMediaKeySession().then(function(mediaKeySessio
n) { | 58 createMediaKeyWithMediaKeySession().then(function(mediaKeySessio
n) { |
| 56 // Should be 1 MediaKeySession. | 59 // Should be 1 MediaKeySession. |
| 57 assert_equals(numActiveDOMObjectsCreated(), 1); | 60 assert_equals(numActiveDOMObjectsCreated(), 1); |
| 58 return createMediaKeyWithMediaKeySession(); | 61 return createMediaKeyWithMediaKeySession(); |
| 59 }).then(function(mediaKeySession) { | 62 }).then(function(mediaKeySession) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 }).then(function(result) { | 120 }).then(function(result) { |
| 118 assert_equals(numActiveDOMObjectsCreated(), 0); | 121 assert_equals(numActiveDOMObjectsCreated(), 0); |
| 119 test.done(); | 122 test.done(); |
| 120 }).catch(function(error) { | 123 }).catch(function(error) { |
| 121 forceTestFailureFromPromise(test, error); | 124 forceTestFailureFromPromise(test, error); |
| 122 }); | 125 }); |
| 123 }, 'Multiple MediaKeys lifetime'); | 126 }, 'Multiple MediaKeys lifetime'); |
| 124 </script> | 127 </script> |
| 125 </body> | 128 </body> |
| 126 </html> | 129 </html> |
| OLD | NEW |