OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>Initialization Data not returned when using different origin</tit le> | |
5 <script src="/js-test-resources/testharness.js"></script> | |
6 <script src="/js-test-resources/testharnessreport.js"></script> | |
7 </head> | |
8 <body> | |
9 <video id="testVideo1"></video> | |
10 <video id="testVideo2"></video> | |
jrummell
2015/02/07 00:12:26
Don't need both video elements -- I'll fix it.
jrummell
2015/02/07 02:11:47
Done.
| |
11 <div id="log"></div> | |
12 <script> | |
13 async_test(function(test) | |
14 { | |
15 var video = document.getElementById('testVideo2'); | |
16 var encryptedEventCount = 0; | |
17 | |
18 function onEncrypted(event) | |
19 { | |
20 assert_equals(event.target, video); | |
21 assert_true(event instanceof window.MediaEncryptedEvent); | |
22 assert_equals(event.type, 'encrypted'); | |
23 | |
24 // Since the .src is in a different origin as this test, | |
25 // both initDataType and initData should be empty. | |
26 assert_equals(event.initDataType, ''); | |
27 assert_equals(event.initData.byteLength, 0); | |
28 | |
29 // Both the audio and the video tracks have initData, | |
30 // so finish once both events are received. | |
31 if (++encryptedEventCount == 2) | |
32 test.done(); | |
33 } | |
34 | |
35 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t hen(function(access) { | |
36 return access.createMediaKeys(); | |
37 }).then(function(mediaKeys) { | |
38 video.addEventListener('encrypted', test.step_func(onEncrypt ed), true); | |
39 return video.setMediaKeys(mediaKeys); | |
40 }).then(function(result) { | |
41 // Verify that the current origin is different than what | |
42 // we use for the content. | |
43 assert_equals(document.origin, 'http://127.0.0.1:8000'); | |
44 video.src = 'http://127.0.0.1:8080/media/encrypted-media/tes t-encrypted.webm'; | |
45 video.play(); | |
46 }); | |
47 }, 'Initialization Data not returned when using different origin.'); | |
48 </script> | |
49 </body> | |
50 </html> | |
OLD | NEW |