| 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 <script src="resources/helper.js"></script> |
| 5 <iframe src="about:blank" allow="fullscreen"></iframe> |
| 6 <iframe src="about:blank" allow="fullscreen" allowfullscreen></iframe> |
| 7 <iframe src="about:blank" allowfullscreen></iframe> |
| 4 <script> | 8 <script> |
| 5 if (window.testRunner) { | 9 var srcs = [ |
| 6 testRunner.dumpAsText(); | 10 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
", |
| 7 testRunner.dumpAsText(); | 11 "resources/feature-policy-fullscreen-relocate.html" |
| 8 } | 12 ]; |
| 9 </script> | 13 |
| 10 <iframe id="f1" src="about:blank" allow="fullscreen"></iframe> | 14 function loadFrame(iframe, src) { |
| 11 <iframe id="f2" src="about:blank" allow="fullscreen" allowfullscreen></iframe> | 15 var allowFullscreen = iframe.allowFullscreen; |
| 12 <iframe id="f3" src="about:blank" allowfullscreen></iframe> | 16 var allow = iframe.hasAttribute('allow'); |
| 13 <iframe id="f4" src="about:blank" allow="fullscreen"></iframe> | 17 // fullscreen is enabled if: |
| 14 <iframe id="f5" src="about:blank" allow="fullscreen" allowfullscreen></iframe> | 18 // a. relocating within the same origin; or |
| 15 <iframe id="f6" src="about:blank" allowfullscreen></iframe> | 19 // b. relocating across origin, with allowfullscreen not overriden by |
| 16 <script> | 20 // container policy. |
| 17 function loadFrame(id, src, is_feature_enabled) { | 21 var expectedEnabled = |
| 18 var iframe = document.getElementById(id); | 22 (src === srcs[0]) || (src === srcs[1] && iframe.allowFullscreen && !allow) |
| 19 promise_test(function(t) { | 23 promise_test(function() { |
| 20 iframe.src = src; | 24 iframe.src = src; |
| 21 return new Promise(function(resolve, reject) { | 25 return new Promise(function(resolve, reject) { |
| 22 window.addEventListener('message', function(e) { | 26 window.addEventListener('message', function(e) { |
| 23 if (e.data.type === 'change' || e.data.type === 'error') { | |
| 24 resolve(e.data); | 27 resolve(e.data); |
| 25 } | 28 }, { once: true }); |
| 26 }); | |
| 27 }).then(function(data) { | 29 }).then(function(data) { |
| 28 if (is_feature_enabled) { | 30 if (expectedEnabled) { |
| 29 assert_true(data.enabled, 'Document.fullscreenEnabled:'); | 31 assert_true(data.enabled, 'Document.fullscreenEnabled:'); |
| 30 assert_equals(data.type, 'change', 'Document.requestFullscreen():'); | 32 assert_equals(data.type, 'change', 'Document.requestFullscreen():'); |
| 31 } else { | 33 } else { |
| 32 assert_false(data.enabled, 'Document.fullscreenEnabled:'); | 34 assert_false(data.enabled, 'Document.fullscreenEnabled:'); |
| 33 assert_equals(data.type, 'error', 'Document.requestFullscreen():'); | 35 assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
| 34 } | 36 } |
| 35 }); | 37 }); |
| 36 }, 'iframe ' + id + ' relocated to URL: ' + src + ' with allowfullscreen = ' +
iframe.allowFullscreen + ' is ' + (is_feature_enabled ? 'enabled' : 'disabled')
+ ' by container policy.'); | 38 }, 'Iframe src set to ' + src + ', allowpaymentrequest = ' + |
| 39 allowFullscreen + ', allow = ' + (allow ? 'fullscreen' : 'undefined') + |
| 40 ', fullscreen is ' + (expectedEnabled ? 'enabled' : 'disabled') + |
| 41 ' by container policy.'); |
| 37 } | 42 } |
| 38 loadFrame("f1", "http://localhost:8000/feature-policy/resources/feature-policy-f
ullscreen.html", true); | 43 |
| 39 loadFrame("f2", "http://localhost:8000/feature-policy/resources/feature-policy-f
ullscreen.html", true); | 44 window.onload = function() { |
| 40 loadFrame("f3", "http://localhost:8000/feature-policy/resources/feature-policy-f
ullscreen.html", true); | 45 loadIframes(srcs); |
| 41 loadFrame("f4", "resources/feature-policy-fullscreen-relocate.html", false); | 46 } |
| 42 loadFrame("f5", "resources/feature-policy-fullscreen-relocate.html", false); | |
| 43 loadFrame("f6", "resources/feature-policy-fullscreen-relocate.html", true); | |
| 44 </script> | 47 </script> |
| OLD | NEW |