Index: third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-disabled.php |
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-disabled.php b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-disabled.php |
index fade4c3dd24eba39d71228ee62bacfe0876c67c4..68f3a09e661f6f396b3e7561440fe473dc1d432f 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-disabled.php |
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-disabled.php |
@@ -12,32 +12,36 @@ Header("Feature-Policy: {\"fullscreen\": []}"); |
<!DOCTYPE html> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
-<iframe id="f1"></iframe> |
-<iframe id="f2" allowfullscreen></iframe> |
+<iframe></iframe> |
+<iframe allowfullscreen></iframe> |
<script> |
var srcs = [ |
"resources/feature-policy-fullscreen.html", |
"http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html" |
]; |
-var f1 = document.getElementById('f1'); |
-var f2 = document.getElementById('f2'); |
-function loadFrames(iframe) { |
- for (var src of srcs) { |
- promise_test(function() { |
- iframe.src = src; |
- return new Promise(function(resolve, reject) { |
- window.addEventListener('message', function(e) { |
- resolve(e.data); |
- }, { once: true }); |
- }).then(function(data) { |
- assert_false(data.enabled, 'Document.fullscreenEnabled:'); |
- assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
- }); |
- }, 'Fullscreen disabled on URL: ' + src + ' with allowfullscreen = ' + iframe.allowFullscreen); |
- } |
+function loadFrame(iframe, src) { |
+ var allowfullscreen = iframe.allowFullscreen; |
+ promise_test(function() { |
+ iframe.src = src; |
+ return new Promise(function(resolve, reject) { |
+ window.addEventListener('message', function(e) { |
+ resolve(e.data); |
+ }, { once: true }); |
+ }).then(function(data) { |
+ assert_false(data.enabled, 'Document.fullscreenEnabled:'); |
+ assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
+ }); |
+ }, 'Fullscreen disabled on URL: ' + src + ' with allowfullscreen = ' + |
+ allowfullscreen); |
} |
-loadFrames(f1); |
-loadFrames(f2); |
+window.onload = function() { |
+ var iframes = document.getElementsByTagName('iframe'); |
+ for (var iframe of iframes) { |
+ for (var src of srcs) { |
+ loadFrame(iframe, src); |
+ } |
+ } |
+} |
</script> |