OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html lang="en"> | 2 <html lang="en"> |
3 <head> | 3 <head> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <video></video> | 6 <video></video> |
7 <p>Test all the key-related events.</p> | 7 <p>Test all the key-related events.</p> |
8 | 8 |
9 <script src="../encrypted-media-utils.js"></script> | 9 <script src="../encrypted-media-utils.js"></script> |
10 <script src=../../media-file.js></script> | 10 <script src=../../media-file.js></script> |
11 <script src=../../video-test.js></script> | 11 <script src=../../video-test.js></script> |
12 <script> | 12 <script> |
13 // First, try explicitly creating those events with specific IDL. | 13 // First, try explicitly creating those events with specific IDL. |
14 var messageEvent = document.createEvent("MediaKeyMessageEvent"); | 14 var messageEvent = document.createEvent("MediaKeyMessageEvent"); |
15 testExpected("messageEvent", null, "!="); | 15 testExpected("messageEvent", null, "!="); |
16 testExpected("messageEvent instanceof window.MediaKeyMessageEvent",
true); | 16 testExpected("messageEvent instanceof window.MediaKeyMessageEvent",
true); |
17 var keyNeededEvent = document.createEvent("MediaKeyNeededEvent"); | 17 var keyNeededEvent = document.createEvent("MediaKeyEvent"); |
18 testExpected("keyNeededEvent", null, "!="); | 18 testExpected("keyNeededEvent", null, "!="); |
19 testExpected("keyNeededEvent instanceof window.MediaKeyNeededEvent",
true); | 19 testExpected("keyNeededEvent instanceof window.MediaKeyEvent", true)
; |
20 | 20 |
21 // Next, The test runs twice, once using on* and then using addEvent
Listener(). | 21 // Next, The test runs twice, once using on* and then using addEvent
Listener(). |
22 var isFirstRun = true; | 22 var isFirstRun = true; |
23 | 23 |
24 // The Initialization Data in test-encrypted.webm. | 24 // The Initialization Data in test-encrypted.webm. |
25 var expectedInitData = stringToUint8Array('0123456789012345'); | 25 var expectedInitData = stringToUint8Array('0123456789012345'); |
26 // A 128-bit key. It is not the actual key for test-encrypted.webm. | 26 // A 128-bit key. It is not the actual key for test-encrypted.webm. |
27 var key = new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, | 27 var key = new Uint8Array([0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, |
28 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70]); | 28 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70]); |
29 // This key will cause an asynchronous error because it is too short
. | 29 // This key will cause an asynchronous error because it is too short
. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 testExpected("video.onwebkitkeyadded", null, "==="); | 195 testExpected("video.onwebkitkeyadded", null, "==="); |
196 testExpected("video.onwebkitkeyerror", null, "==="); | 196 testExpected("video.onwebkitkeyerror", null, "==="); |
197 testExpected("video.onwebkitkeymessage", null, "==="); | 197 testExpected("video.onwebkitkeymessage", null, "==="); |
198 testExpected("video.onwebkitneedkey", null, "==="); | 198 testExpected("video.onwebkitneedkey", null, "==="); |
199 | 199 |
200 runTest(); | 200 runTest(); |
201 | 201 |
202 </script> | 202 </script> |
203 </body> | 203 </body> |
204 </html> | 204 </html> |
OLD | NEW |