| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Reloading during encrypted media playback</title> | 4 <title>Reloading during encrypted media playback</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 <video id="testVideo"></video> | 10 <video id="testVideo"></video> |
| 11 <div id="log"></div> | 11 <div id="log"></div> |
| 12 <script> | 12 <script> |
| 13 async_test(function(test) | 13 async_test(function(test) |
| 14 { | 14 { |
| 15 var video = document.getElementById('testVideo'); | 15 var video = document.getElementById('testVideo'); |
| 16 var content = '../content/test-encrypted.webm'; |
| 16 var mediaKeySession = null; | 17 var mediaKeySession = null; |
| 17 var hasSessionUpdateSucceeded = false; | 18 var hasSessionUpdateSucceeded = false; |
| 18 var encryptedEventCount = 0; | 19 var encryptedEventCount = 0; |
| 19 | 20 |
| 20 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, | 21 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, |
| 21 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); | 22 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); |
| 22 | 23 |
| 23 function onEncrypted(event) | 24 function onEncrypted(event) |
| 24 { | 25 { |
| 25 assert_equals(event.target, video); | 26 assert_equals(event.target, video); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Reload the page to catch any possible teardown issues. | 74 // Reload the page to catch any possible teardown issues. |
| 74 if (location.hash == '#x') { | 75 if (location.hash == '#x') { |
| 75 test.done(); | 76 test.done(); |
| 76 return; | 77 return; |
| 77 } | 78 } |
| 78 | 79 |
| 79 location.hash += 'x'; | 80 location.hash += 'x'; |
| 80 location.reload(); | 81 location.reload(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 84 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConf
igurationForFile(content)).then(function(access) { |
| 84 return access.createMediaKeys(); | 85 return access.createMediaKeys(); |
| 85 }).then(function(mediaKeys) { | 86 }).then(function(mediaKeys) { |
| 86 waitForEventAndRunStep('encrypted', video, onEncrypted, test
); | 87 waitForEventAndRunStep('encrypted', video, onEncrypted, test
); |
| 87 waitForEventAndRunStep('playing', video, onPlaying, test); | 88 waitForEventAndRunStep('playing', video, onPlaying, test); |
| 88 video.src = '../content/test-encrypted.webm'; | 89 video.src = content; |
| 89 return video.setMediaKeys(mediaKeys); | 90 return video.setMediaKeys(mediaKeys); |
| 90 }).then(function(result) { | 91 }).then(function(result) { |
| 91 video.play(); | 92 video.play(); |
| 92 }).catch(function(error) { | 93 }).catch(function(error) { |
| 93 forceTestFailureFromPromise(test, error); | 94 forceTestFailureFromPromise(test, error); |
| 94 }); | 95 }); |
| 95 }, 'Reloading during encrypted media playback.'); | 96 }, 'Reloading during encrypted media playback.'); |
| 96 </script> | 97 </script> |
| 97 </body> | 98 </body> |
| 98 </html> | 99 </html> |
| OLD | NEW |