OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Unique origin is unable to create MediaKeys</title> | 4 <title>Unique origin is unable to create MediaKeys</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
(...skipping 17 matching lines...) Expand all Loading... |
28 resolve(e.data); | 28 resolve(e.data); |
29 self.removeEventListener('message', listener); | 29 self.removeEventListener('message', listener); |
30 }); | 30 }); |
31 }); | 31 }); |
32 } | 32 } |
33 | 33 |
34 promise_test(function(test) { | 34 promise_test(function(test) { |
35 var script = 'data:text/html,' + | 35 var script = 'data:text/html,' + |
36 '<script>' + | 36 '<script>' + |
37 ' window.onmessage = function(e) {' + | 37 ' window.onmessage = function(e) {' + |
38 ' navigator.requestMediaKeySystemAccess(\'org.w3.clea
rkey\', [{}]).then(function(access) {' + | 38 ' navigator.requestMediaKeySystemAccess(\'org.w3.clea
rkey\', [{' + |
| 39 ' initDataTypes: [ \'keyids\' ],' + |
| 40 ' audioCapabilities: [' + |
| 41 ' { contentType: \'audio/mp4; codecs="mp4a.40.
2"\' },' + |
| 42 ' { contentType: \'audio/webm; codecs="opus"\'
}' + |
| 43 ' ]' + |
| 44 ' }]).then(function(access) {' + |
39 ' return access.createMediaKeys();' + | 45 ' return access.createMediaKeys();' + |
40 ' }).then(function(mediaKeys) {' + | 46 ' }).then(function(mediaKeys) {' + |
41 ' window.parent.postMessage({result: \'allowed\'}
, \'*\');' + | 47 ' window.parent.postMessage({result: \'allowed\'}
, \'*\');' + |
42 ' }, function(error) {' + | 48 ' }, function(error) {' + |
43 ' window.parent.postMessage({result: \'failed\'},
\'*\');' + | 49 ' window.parent.postMessage({result: \'failed\'},
\'*\');' + |
44 ' });' + | 50 ' });' + |
45 ' };' + | 51 ' };' + |
46 '<\/script>'; | 52 '<\/script>'; |
47 | 53 |
48 // Verify that this page can create a MediaKeys first. | 54 // Verify that this page can create a MediaKeys first. |
49 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 55 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{ |
| 56 initDataTypes: [ 'keyids' ], |
| 57 audioCapabilities: [ |
| 58 { contentType: 'audio/mp4; codecs="mp4a.40.2"' }, |
| 59 { contentType: 'audio/webm; codecs="opus"' } |
| 60 ] |
| 61 }]).then(function(access) { |
50 return access.createMediaKeys(); | 62 return access.createMediaKeys(); |
51 }).then(function(mediaKeys) { | 63 }).then(function(mediaKeys) { |
52 // Success, so now create the iframe and try there. | 64 // Success, so now create the iframe and try there. |
53 return load_iframe(script, 'allow-scripts') | 65 return load_iframe(script, 'allow-scripts') |
54 }).then(function(iframe) { | 66 }).then(function(iframe) { |
55 iframe.contentWindow.postMessage({}, '*'); | 67 iframe.contentWindow.postMessage({}, '*'); |
56 return wait_for_message(); | 68 return wait_for_message(); |
57 }).then(function(message) { | 69 }).then(function(message) { |
58 assert_equals(message.result, 'failed'); | 70 assert_equals(message.result, 'failed'); |
59 }); | 71 }); |
60 }, 'Unique origin is unable to create MediaKeys'); | 72 }, 'Unique origin is unable to create MediaKeys'); |
61 </script> | 73 </script> |
62 </body> | 74 </body> |
63 </html> | 75 </html> |
OLD | NEW |