Chromium Code Reviews| 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"); |
|
wolenetz
2014/10/02 00:15:20
nit: this seems more than just a rename, and it ap
wolenetz
2014/10/02 18:11:34
I received clarification from sandersd@ that this
| |
| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 // Not supported by the test file. | 133 // Not supported by the test file. |
| 134 testExpected("event.defaultURL", ""); | 134 testExpected("event.defaultURL", ""); |
| 135 // The error attributes are not used for this event. | 135 // The error attributes are not used for this event. |
| 136 testExpected("event.errorCode", null, "==="); | 136 testExpected("event.errorCode", null, "==="); |
| 137 testExpected("event.systemCode", 0); | 137 testExpected("event.systemCode", 0); |
| 138 | 138 |
| 139 consoleWrite(""); | 139 consoleWrite(""); |
| 140 run("video.webkitAddKey('webkit-org.w3.clearkey', key, event.ini tData, event.sessionId)"); | 140 run("video.webkitAddKey('webkit-org.w3.clearkey', key, event.ini tData, event.sessionId)"); |
| 141 } | 141 } |
| 142 | 142 |
| 143 function needKey(event) | 143 function needKey(event) |
|
wolenetz
2014/10/02 00:15:20
eme noob question: Is this correct across the rena
wolenetz
2014/10/02 18:11:34
I received clarification (see previous comment in
| |
| 144 { | 144 { |
| 145 consoleWrite("needkey event occurred"); | 145 consoleWrite("needkey event occurred"); |
| 146 // Clear the handler (for the first case) to prevent the second needkey event | 146 // Clear the handler (for the first case) to prevent the second needkey event |
| 147 // (there will be one each for audio and video) from being handl ed. | 147 // (there will be one each for audio and video) from being handl ed. |
| 148 video.onwebkitneedkey=null; | 148 video.onwebkitneedkey=null; |
| 149 | 149 |
| 150 testExpected("event.target", video); | 150 testExpected("event.target", video); |
| 151 testExpected("event instanceof window.MediaKeyEvent", true); | 151 testExpected("event instanceof window.MediaKeyEvent", true); |
| 152 | 152 |
| 153 testExpected("event.keySystem", ""); | 153 testExpected("event.keySystem", ""); |
| (...skipping 41 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 |