Index: third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html |
index 0fb8d85dba713e5c80a75a4fd205e859cef5ac67..17de45272dd66f319814fc46896ffb84e2fbf46c 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html |
@@ -1,31 +1,32 @@ |
<!DOCTYPE html> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
+<iframe src="about:blank" allow="fullscreen"></iframe> |
+<iframe src="about:blank" allow="fullscreen" allowfullscreen></iframe> |
+<iframe src="about:blank" allowfullscreen></iframe> |
<script> |
- if (window.testRunner) { |
- testRunner.dumpAsText(); |
- testRunner.dumpAsText(); |
- } |
-</script> |
-<iframe id="f1" src="about:blank" allow="fullscreen"></iframe> |
-<iframe id="f2" src="about:blank" allow="fullscreen" allowfullscreen></iframe> |
-<iframe id="f3" src="about:blank" allowfullscreen></iframe> |
-<iframe id="f4" src="about:blank" allow="fullscreen"></iframe> |
-<iframe id="f5" src="about:blank" allow="fullscreen" allowfullscreen></iframe> |
-<iframe id="f6" src="about:blank" allowfullscreen></iframe> |
-<script> |
-function loadFrame(id, src, is_feature_enabled) { |
- var iframe = document.getElementById(id); |
- promise_test(function(t) { |
+var srcs = [ |
+ "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html", |
+ "resources/feature-policy-fullscreen-relocate.html" |
+]; |
+ |
+function loadFrame(iframe, src) { |
+ var allowfullscreen = iframe.allowFullscreen; |
iclelland
2017/05/18 19:56:59
allowfullscreen => allowFullscreen
|
+ var allow = iframe.hasAttribute('allow'); |
+ // fullscreen is enabled if: |
+ // a. relocating within the same origin; or |
+ // b. relocating across origin, with allowfullscreen not overriden by |
+ // container policy. |
+ var enabled = |
iclelland
2017/05/18 19:56:58
I think we should call this something like "expect
lunalu1
2017/05/19 20:54:08
Done
|
+ (src === srcs[0]) || (src === srcs[1] && iframe.allowFullscreen && !allow) |
+ promise_test(function() { |
iframe.src = src; |
return new Promise(function(resolve, reject) { |
window.addEventListener('message', function(e) { |
- if (e.data.type === 'change' || e.data.type === 'error') { |
resolve(e.data); |
- } |
- }); |
+ }, { once: true }); |
}).then(function(data) { |
- if (is_feature_enabled) { |
+ if (enabled) { |
assert_true(data.enabled, 'Document.fullscreenEnabled:'); |
assert_equals(data.type, 'change', 'Document.requestFullscreen():'); |
} else { |
@@ -33,12 +34,17 @@ function loadFrame(id, src, is_feature_enabled) { |
assert_equals(data.type, 'error', 'Document.requestFullscreen():'); |
} |
}); |
- }, 'iframe ' + id + ' relocated to URL: ' + src + ' with allowfullscreen = ' + iframe.allowFullscreen + ' is ' + (is_feature_enabled ? 'enabled' : 'disabled') + ' by container policy.'); |
+ }, 'iframe relocated to URL: ' + src + ' with allowpaymentrequest = ' + |
+ allowfullscreen + ' allow = ' + (allow ? 'fullscreen' : 'undefined') + |
+ ' is ' + (enabled ? 'enabled' : 'disabled') + ' by container policy.'); |
+} |
+ |
+window.onload = function() { |
+ var iframes = document.getElementsByTagName('iframe'); |
+ for (var src of srcs) { |
+ for (var iframe of iframes) { |
+ loadFrame(iframe, src); |
+ } |
+ } |
} |
-loadFrame("f1", "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html", true); |
-loadFrame("f2", "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html", true); |
-loadFrame("f3", "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html", true); |
-loadFrame("f4", "resources/feature-policy-fullscreen-relocate.html", false); |
-loadFrame("f5", "resources/feature-policy-fullscreen-relocate.html", false); |
-loadFrame("f6", "resources/feature-policy-fullscreen-relocate.html", true); |
</script> |