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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/embedded-enforcement/subsumption_algorithm-general.html

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Embedded Enforcement: Subsumption Algorithm - Basic implementation.</titl e>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="support/testharness-helper.sub.js"></script>
8 </head>
9 <body>
10 <script>
11 var tests = [
12 { "name": "If there is no required csp, iframe should load.",
13 "required_csp": null,
14 "returned_csp": null,
15 "expected": IframeLoad.EXPECT_LOAD },
16 { "name": "Iframe with empty returned CSP should be blocked.",
17 "required_csp": "style-src 'none';",
18 "returned_csp": null,
19 "expected": IframeLoad.EXPECT_BLOCK },
20 { "name": "Iframe with matching CSP should load.",
21 "required_csp": "style-src 'none'; script-src 'unsafe-inline'",
22 "returned_csp": "style-src 'none'; script-src 'unsafe-inline'",
23 "expected": IframeLoad.EXPECT_LOAD },
24 { "name": "Iframe with more restricting CSP should load.",
25 "required_csp": "script-src 'nonce-abc' 'nonce-123'",
26 "returned_csp": "script-src 'nonce-abc'",
27 "expected": IframeLoad.EXPECT_LOAD },
28 { "name": "Iframe with less restricting CSP should be blocked.",
29 "required_csp": "style-src 'none'; script-src 'none'",
30 "returned_csp": "style-src 'none'; script-src 'self'",
31 "expected": IframeLoad.EXPECT_BLOCK },
32 { "name": "Iframe with a different CSP should be blocked.",
33 "required_csp": "script-src 'nonce-abc' 'nonce-123'",
34 "returned_csp": "style-src 'none'",
35 "expected": IframeLoad.EXPECT_BLOCK },
36 { "name": "Iframe with a matching and more restrictive ports should load." ,
37 "required_csp": "frame-src http://c.com:443 http://b.com",
38 "returned_csp": "frame-src http://b.com:80 http://c.com:443",
39 "expected": IframeLoad.EXPECT_LOAD },
40 { "name": "Iframe should load even if the ports are different but are defa ult for the protocols.",
41 "required_csp": "frame-src http://b.com:80",
42 "returned_csp": "child-src https://b.com:443",
43 "expected": IframeLoad.EXPECT_LOAD },
44 ];
45
46 tests.forEach(test => {
47 async_test(t => {
48 var url = generateUrlWithPolicies(Host.CROSS_ORIGIN, test.returned_csp);
49 assert_iframe_with_csp(t, url, test.required_csp, test.expected, test.na me, null);
50 }, test.name);
51 });
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698