OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>onencrypted</title> | 4 <title>onencrypted</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" controls></video> | 10 <video id="testVideo" controls></video> |
11 <div id="log"></div> | 11 <div id="log"></div> |
12 <script> | 12 <script> |
13 var expectedInitData = stringToUint8Array('0123456789012345'); | 13 var expectedInitData = stringToUint8Array('0123456789012345'); |
14 | 14 |
15 // Will get 2 identical events, one for audio, one for video. | 15 // Will get 2 identical events, one for audio, one for video. |
16 var expectedEvents = 2; | 16 var expectedEvents = 2; |
17 | 17 |
18 async_test(function(test) | 18 async_test(function(test) |
19 { | 19 { |
20 var video = document.getElementById('testVideo'); | 20 var video = document.getElementById('testVideo'); |
| 21 var content = '../content/test-encrypted.webm'; |
21 | 22 |
22 var onEncrypted = function(event) | 23 var onEncrypted = function(event) |
23 { | 24 { |
24 assert_equals(event.target, video); | 25 assert_equals(event.target, video); |
25 assert_true(event instanceof window.MediaEncryptedEvent); | 26 assert_true(event instanceof window.MediaEncryptedEvent); |
26 assert_equals(event.type, 'encrypted'); | 27 assert_equals(event.type, 'encrypted'); |
27 assert_equals(event.initDataType, 'webm'); | 28 assert_equals(event.initDataType, 'webm'); |
28 assert_array_equals(new Uint8Array(event.initData), expected
InitData); | 29 assert_array_equals(new Uint8Array(event.initData), expected
InitData); |
29 | 30 |
30 if (--expectedEvents == 0) | 31 if (--expectedEvents == 0) |
31 test.done(); | 32 test.done(); |
32 }; | 33 }; |
33 | 34 |
34 waitForEventAndRunStep('encrypted', video, onEncrypted, test); | 35 waitForEventAndRunStep('encrypted', video, onEncrypted, test); |
35 video.src = '../content/test-encrypted.webm'; | 36 video.src = content; |
36 }, 'encrypted fired on encrypted media file.'); | 37 }, 'encrypted fired on encrypted media file.'); |
37 </script> | 38 </script> |
38 </body> | 39 </body> |
39 </html> | 40 </html> |
OLD | NEW |