| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 // This test ensures that fullscreen feature when disabled may not be called by | 6 // This test ensures that fullscreen feature when disabled may not be called by |
| 7 // any iframe even when allowfullscreen is set. | 7 // any iframe even when allowfullscreen is set. |
| 8 | 8 |
| 9 Header("Feature-Policy: {\"fullscreen\": []}"); | 9 Header("Feature-Policy: {\"fullscreen\": []}"); |
| 10 ?> | 10 ?> |
| 11 | 11 |
| 12 <!DOCTYPE html> | 12 <!DOCTYPE html> |
| 13 <script src="../../resources/testharness.js"></script> | 13 <script src="../../resources/testharness.js"></script> |
| 14 <script src="../../resources/testharnessreport.js"></script> | 14 <script src="../../resources/testharnessreport.js"></script> |
| 15 <iframe id="f1"></iframe> | 15 <script src="resources/helper.js"></script> |
| 16 <iframe id="f2" allowfullscreen></iframe> | 16 <iframe></iframe> |
| 17 <iframe allowfullscreen></iframe> |
| 17 <script> | 18 <script> |
| 18 var srcs = [ | 19 var srcs = [ |
| 19 "resources/feature-policy-fullscreen.html", | 20 "resources/feature-policy-fullscreen.html", |
| 20 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
" | 21 "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html
" |
| 21 ]; | 22 ]; |
| 22 var f1 = document.getElementById('f1'); | |
| 23 var f2 = document.getElementById('f2'); | |
| 24 | 23 |
| 25 function loadFrames(iframe) { | 24 function loadFrame(iframe, src) { |
| 26 for (var src of srcs) { | 25 var allowfullscreen = iframe.allowFullscreen; |
| 27 promise_test(function() { | 26 promise_test(function() { |
| 28 iframe.src = src; | 27 iframe.src = src; |
| 29 return new Promise(function(resolve, reject) { | 28 return new Promise(function(resolve, reject) { |
| 30 window.addEventListener('message', function(e) { | 29 window.addEventListener('message', function(e) { |
| 31 resolve(e.data); | 30 resolve(e.data); |
| 32 }, { once: true }); | 31 }, { once: true }); |
| 33 }).then(function(data) { | 32 }).then(function(data) { |
| 34 assert_false(data.enabled, 'Document.fullscreenEnabled:'); | 33 assert_false(data.enabled, 'Document.fullscreenEnabled:'); |
| 35 assert_equals(data.type, 'error', 'Document.requestFullscreen():'); | 34 assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
| 36 }); | 35 }); |
| 37 }, 'Fullscreen disabled on URL: ' + src + ' with allowfullscreen = ' + ifram
e.allowFullscreen); | 36 }, 'Fullscreen disabled on URL: ' + src + ' with allowfullscreen = ' + |
| 38 } | 37 allowfullscreen); |
| 39 } | 38 } |
| 40 | 39 |
| 41 loadFrames(f1); | 40 window.onload = function() { |
| 42 loadFrames(f2); | 41 loadIframes(srcs); |
| 42 } |
| 43 </script> | 43 </script> |
| OLD | NEW |