Chromium Code Reviews

Unified Diff: third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php

Issue 2855133004: Re-enable feature policy layout tests after bug fix. (Closed)
Patch Set: Rebased FlagExpectations/site-per-process Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php b/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php
index 4c6d52926fa800e8f3c684dc8cec2655fbf3b8bd..0d145640559c62705b919dfe3f025fc44ac8644c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-enabledforall.php
@@ -13,13 +13,35 @@ Header("Feature-Policy: {\"payment\": [\"*\"]}");
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
+<iframe></iframe>
+<iframe allowpaymentrequest></iframe>
<script>
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.dumpChildFramesAsText();
+var srcs = [
+ "resources/feature-policy-payment.html",
+ "http://localhost:8000/feature-policy/resources/feature-policy-payment.html"
+];
+
+function loadFrame(iframe, src) {
+ var allowpaymentrequest = iframe.hasAttribute('allowpaymentrequest');
+ 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_true(data.enabled, 'Paymentrequest():');
+ });
+ }, 'Paymentrequest enabled for all on URL: ' + src + ' with ' +
+ 'allowpaymentrequest = ' + allowpaymentrequest);
+}
+
+window.onload = function() {
+ var iframes = document.getElementsByTagName('iframe');
+ for (var iframe of iframes) {
+ for (var src of srcs) {
+ loadFrame(iframe, src);
+ }
}
+}
</script>
-<iframe id="f1" src="resources/feature-policy-payment-enabled.html"></iframe>
-<iframe id="f2" src="http://localhost:8000/feature-policy/resources/feature-policy-payment-enabled.html"></iframe>
-<iframe id="f3" src="resources/feature-policy-payment-enabled.html" allowpaymentrequest></iframe>
-<iframe id="f4" src="http://localhost:8000/feature-policy/resources/feature-policy-payment-enabled.html" allowpaymentrequest></iframe>

Powered by Google App Engine