Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-unique-origin.html

Issue 1463763002: Add event name to bare removeEventListener(listener) calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 // When the sandbox attribute is present on an iframe, it will 11 // When the sandbox attribute is present on an iframe, it will
12 // treat the content as being from a unique origin. So try to 12 // treat the content as being from a unique origin. So try to
13 // call createMediaKeys() inside an iframe and it should fail. 13 // call createMediaKeys() inside an iframe and it should fail.
14 14
15 function load_iframe(src, sandbox) { 15 function load_iframe(src, sandbox) {
16 return new Promise(function(resolve) { 16 return new Promise(function(resolve) {
17 var iframe = document.createElement('iframe'); 17 var iframe = document.createElement('iframe');
18 iframe.onload = function() { resolve(iframe); }; 18 iframe.onload = function() { resolve(iframe); };
19 iframe.sandbox = sandbox; 19 iframe.sandbox = sandbox;
20 iframe.src = src; 20 iframe.src = src;
21 document.documentElement.appendChild(iframe); 21 document.documentElement.appendChild(iframe);
22 }); 22 });
23 } 23 }
24 24
25 function wait_for_message() { 25 function wait_for_message() {
26 return new Promise(function(resolve) { 26 return new Promise(function(resolve) {
27 self.addEventListener('message', function listener(e) { 27 self.addEventListener('message', function listener(e) {
28 resolve(e.data); 28 resolve(e.data);
29 self.removeEventListener(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\', [{}]).then(function(access) {' +
39 ' return access.createMediaKeys();' + 39 ' return access.createMediaKeys();' +
(...skipping 14 matching lines...) Expand all
54 }).then(function(iframe) { 54 }).then(function(iframe) {
55 iframe.contentWindow.postMessage({}, '*'); 55 iframe.contentWindow.postMessage({}, '*');
56 return wait_for_message(); 56 return wait_for_message();
57 }).then(function(message) { 57 }).then(function(message) {
58 assert_equals(message.result, 'failed'); 58 assert_equals(message.result, 'failed');
59 }); 59 });
60 }, 'Unique origin is unable to create MediaKeys'); 60 }, 'Unique origin is unable to create MediaKeys');
61 </script> 61 </script>
62 </body> 62 </body>
63 </html> 63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698