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> |
(...skipping 15 matching lines...) Expand all Loading... |
26 assert_equals(event.target, video); | 26 assert_equals(event.target, video); |
27 assert_true(event instanceof window.MediaKeyNeededEvent); | 27 assert_true(event instanceof window.MediaKeyNeededEvent); |
28 assert_equals(event.type, 'needkey'); | 28 assert_equals(event.type, 'needkey'); |
29 | 29 |
30 // The same decryption key is shared by all streams so only | 30 // The same decryption key is shared by all streams so only |
31 // create a shared session once. | 31 // create a shared session once. |
32 if (isSessionCreated) | 32 if (isSessionCreated) |
33 return; | 33 return; |
34 isSessionCreated = true; | 34 isSessionCreated = true; |
35 | 35 |
36 video.mediaKeys.createSession(event.contentType, event.initD
ata).then(function(result) { | 36 mediaKeySession = video.mediaKeys.createSession(); |
37 mediaKeySession = result; | 37 waitForEventAndRunStep('message', mediaKeySession, onMessage
, test); |
38 waitForEventAndRunStep('message', mediaKeySession, onMes
sage, test); | 38 mediaKeySession.generateRequest(event.contentType, event.ini
tData).catch(function(error) { |
39 }).catch(function(error) { | |
40 forceTestFailureFromPromise(test, error); | 39 forceTestFailureFromPromise(test, error); |
41 }); | 40 }); |
42 } | 41 } |
43 | 42 |
44 function onMessage(event) | 43 function onMessage(event) |
45 { | 44 { |
46 assert_true(event instanceof window.MediaKeyMessageEvent); | 45 assert_true(event instanceof window.MediaKeyMessageEvent); |
47 assert_equals(event.target, mediaKeySession); | 46 assert_equals(event.target, mediaKeySession); |
48 assert_equals(event.type, 'message'); | 47 assert_equals(event.type, 'message'); |
49 | 48 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 video.setMediaKeys(mediaKeys); | 85 video.setMediaKeys(mediaKeys); |
87 video.src = '../content/test-encrypted.webm'; | 86 video.src = '../content/test-encrypted.webm'; |
88 video.play(); | 87 video.play(); |
89 }).catch(function(error) { | 88 }).catch(function(error) { |
90 forceTestFailureFromPromise(test, error); | 89 forceTestFailureFromPromise(test, error); |
91 }); | 90 }); |
92 }, 'Reloading during encrypted media playback.'); | 91 }, 'Reloading during encrypted media playback.'); |
93 </script> | 92 </script> |
94 </body> | 93 </body> |
95 </html> | 94 </html> |
OLD | NEW |