OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <iframe id="f1" allow="fullscreen"></iframe> | 4 <iframe allow="fullscreen"></iframe> |
5 <iframe id="f2" allow="fullscreen" allowfullscreen></iframe> | 5 <iframe allow="fullscreen" allowfullscreen></iframe> |
6 <script> | 6 <script> |
7 var srcs = [ | 7 var srcs = [ |
8 "resources/feature-policy-fullscreen.html", | 8 "resources/feature-policy-fullscreen.html", |
9 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
" | 9 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
" |
10 ]; | 10 ]; |
11 var f1 = document.getElementById('f1'); | |
12 var f2 = document.getElementById('f2'); | |
13 | 11 |
14 function loadFrames(iframe) { | 12 function loadFrame(iframe, src) { |
15 for (var src of srcs) { | 13 var allowfullscreen = iframe.allowFullscreen; |
16 promise_test(function(t) { | 14 promise_test(function() { |
17 iframe.src = src; | 15 iframe.src = src; |
18 return new Promise(function(resolve, reject) { | 16 return new Promise(function(resolve, reject) { |
19 window.addEventListener('message', function(e) { | 17 window.addEventListener('message', function(e) { |
20 resolve(e.data); | 18 resolve(e.data); |
21 }, { once: true }); | 19 }, { once: true }); |
22 }).then(function(data) { | 20 }).then(function(data) { |
23 assert_true(data.enabled, 'Document.fullscreenEnabled:'); | 21 assert_true(data.enabled, 'Document.fullscreenEnabled:'); |
24 assert_equals(data.type, 'change', 'Document.requestFullscreen():'); | 22 assert_equals(data.type, 'change', 'Document.requestFullscreen():'); |
25 }); | 23 }); |
26 }, 'Fullscreen is allowed on URL: ' + src + ' with allowfullscreen = ' + ifr
ame.allowFullscreen); | 24 }, 'Fullscreen is allowed on URL: ' + src + ' with allowfullscreen = ' + |
| 25 allowfullscreen); |
| 26 } |
| 27 |
| 28 window.onload = function() { |
| 29 var iframes = document.getElementsByTagName('iframe'); |
| 30 for (var iframe of iframes) { |
| 31 for (var src of srcs) { |
| 32 loadFrame(iframe, src); |
| 33 } |
27 } | 34 } |
28 } | 35 } |
29 | |
30 loadFrames(f1); | |
31 loadFrames(f2); | |
32 </script> | 36 </script> |
OLD | NEW |