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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="resources/helper.js"></script>
5 <iframe src="about:blank" allow="payment"></iframe>
6 <iframe src="about:blank" allowpaymentrequest allow="payment"></iframe>
7 <iframe src="about:blank" allowpaymentrequest></iframe>
4 <script> 8 <script>
5 if (window.testRunner) { 9 var srcs = [
6 testRunner.dumpAsText(); 10 "http://localhost:8000/feature-policy/resources/feature-policy-payment.html",
7 testRunner.dumpChildFramesAsText(); 11 "resources/feature-policy-payment-relocate.html"
8 } 12 ];
13
14 function loadFrame(iframe, src) {
15 var allowpaymentrequest = iframe.hasAttribute('allowpaymentrequest');
16 var allow = iframe.hasAttribute('allow');
17 // paymentrequest is enabled if:
18 // a. relocating within the same origin; or
19 // b. relocating across origin, with allowpaymentrequest not overriden by
20 // container policy.
21 var expectedEnabled =
22 (src === srcs[0]) || (src === srcs[1] && allowpaymentrequest && !allow)
23 promise_test(function() {
24 iframe.src = src;
25 return new Promise(function(resolve, reject) {
26 window.addEventListener('message', function(e) {
27 resolve(e.data);
28 }, { once: true });
29 }).then(function(data) {
30 if (expectedEnabled) {
31 assert_true(data.enabled, 'Paymentrequest():');
32 } else {
33 assert_false(data.enabled, 'Paymentrequest():');
34 assert_equals(data.name, 'SecurityError', 'Exception Name:');
35 assert_equals(data.message, "Failed to construct 'PaymentRequest': " +
36 "Must be in a top-level browsing context or an iframe needs to " +
37 "specify 'allowpaymentrequest' explicitly", 'Error Message:');
38 }
39 });
40 }, 'Iframe src set to ' + src + ', allowpaymentrequest = ' +
41 allowpaymentrequest + ', allow = ' + (allow ? 'payment' : 'undefined') +
42 ', payment request is ' + (expectedEnabled ? 'enabled' : 'disabled') +
43 ' by container policy.');
44 }
45
46 window.onload = function() {
47 loadIframes(srcs);
48 }
9 </script> 49 </script>
10 <iframe id="f1" src="about:blank" allow="payment"></iframe>
11 <iframe id="f2" src="about:blank" allowpaymentrequest allow="payment"></iframe>
12 <iframe id="f3" src="about:blank" allowpaymentrequest></iframe>
13 <iframe id="f4" src="resources/feature-policy-payment-relocate-disabled.html" al low="payment"></iframe>
14 <iframe id="f5" src="resources/feature-policy-payment-relocate-disabled.html" al lowpaymentrequest allow="payment"></iframe>
15 <iframe id="f6" src="resources/feature-policy-payment-relocate-enabled.html" all owpaymentrequest></iframe>
16 <script>
17 document.getElementById("f1").src = "http://localhost:8000/feature-policy/resour ces/feature-policy-payment-enabled.html";
18 document.getElementById("f2").src = "http://localhost:8000/feature-policy/resour ces/feature-policy-payment-enabled.html";
19 document.getElementById("f3").src = "http://localhost:8000/feature-policy/resour ces/feature-policy-payment-enabled.html";
20 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698