Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html

Issue 2855133004: Re-enable feature policy layout tests after bug fix. (Closed)
Patch Set: Updated fp-vibrate tests expect Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html b/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html
index 7a07fad59dbe5e2aa36a07e456395db5171694fa..bd2e830ae235a6dbf12ce207297887c685cbdee0 100644
--- a/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/payment-allowed-by-container-policy-relocate.html
@@ -1,20 +1,49 @@
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
+<script src="resources/helper.js"></script>
+<iframe src="about:blank" allow="payment"></iframe>
+<iframe src="about:blank" allowpaymentrequest allow="payment"></iframe>
+<iframe src="about:blank" allowpaymentrequest></iframe>
<script>
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.dumpChildFramesAsText();
- }
-</script>
-<iframe id="f1" src="about:blank" allow="payment"></iframe>
-<iframe id="f2" src="about:blank" allowpaymentrequest allow="payment"></iframe>
-<iframe id="f3" src="about:blank" allowpaymentrequest></iframe>
-<iframe id="f4" src="resources/feature-policy-payment-relocate-disabled.html" allow="payment"></iframe>
-<iframe id="f5" src="resources/feature-policy-payment-relocate-disabled.html" allowpaymentrequest allow="payment"></iframe>
-<iframe id="f6" src="resources/feature-policy-payment-relocate-enabled.html" allowpaymentrequest></iframe>
-<script>
-document.getElementById("f1").src = "http://localhost:8000/feature-policy/resources/feature-policy-payment-enabled.html";
-document.getElementById("f2").src = "http://localhost:8000/feature-policy/resources/feature-policy-payment-enabled.html";
-document.getElementById("f3").src = "http://localhost:8000/feature-policy/resources/feature-policy-payment-enabled.html";
+var srcs = [
+ "http://localhost:8000/feature-policy/resources/feature-policy-payment.html",
+ "resources/feature-policy-payment-relocate.html"
+];
+
+function loadFrame(iframe, src) {
+ var allowpaymentrequest = iframe.hasAttribute('allowpaymentrequest');
+ var allow = iframe.hasAttribute('allow');
+ // paymentrequest is enabled if:
+ // a. relocating within the same origin; or
+ // b. relocating across origin, with allowpaymentrequest not overriden by
+ // container policy.
+ var expectedEnabled =
+ (src === srcs[0]) || (src === srcs[1] && allowpaymentrequest && !allow)
+ 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) {
+ if (expectedEnabled) {
+ assert_true(data.enabled, 'Paymentrequest():');
+ } else {
+ assert_false(data.enabled, 'Paymentrequest():');
+ assert_equals(data.name, 'SecurityError', 'Exception Name:');
+ assert_equals(data.message, "Failed to construct 'PaymentRequest': " +
+ "Must be in a top-level browsing context or an iframe needs to " +
+ "specify 'allowpaymentrequest' explicitly", 'Error Message:');
+ }
+ });
+ }, 'Iframe src set to ' + src + ', allowpaymentrequest = ' +
+ allowpaymentrequest + ', allow = ' + (allow ? 'payment' : 'undefined') +
+ ', payment request is ' + (expectedEnabled ? 'enabled' : 'disabled') +
+ ' by container policy.');
+}
+
+window.onload = function() {
+ loadIframes(srcs);
+}
</script>

Powered by Google App Engine
This is Rietveld 408576698