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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html

Issue 2002003002: Generate CSP violation reports for 'block-all-mixed-content' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
3 <head> 3 <script src="/resources/testharness.js"></script>
4 <meta http-equiv="Content-Security-Policy" content="block-all-mixed-content" > 4 <script src="/resources/testharnessreport.js"></script>
5 <script>
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 }
9 </script>
10 </head>
11 <body> 5 <body>
12 <p>This test passes if the image below is treated as blockable content.</p> 6 <script>
13 <img src="http://127.0.0.1:8080/security/resources/compass.jpg"> 7 async_test(t => {
14 </body> 8 var i = document.createElement('img');
15 </html> 9 i.onload = t.assert_unreached;
10 i.onerror = t.step_func_done(_ => {
11 assert_equals(0, i.naturalWidth);
12 assert_equals(0, i.naturalHeight);
13 });
14 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=1";
15 }, "Mixed images are blocked in the presence of 'block-all-mixed-content'.") ;
16
17 async_test(t => {
18 var i = document.createElement('img');
19 i.onload = t.assert_unreached;
20 document.addEventListener('securitypolicyviolation', t.step_func_done(e => {
21 var expectations = {
22 'documentURI': document.location.toString(),
23 'referrer': document.referrer,
24 'blockedURI': 'http://127.0.0.1:8080',
25 'violatedDirective': 'block-all-mixed-content',
26 'effectiveDirective': 'block-all-mixed-content',
27 'originalPolicy': 'block-all-mixed-content',
28 'sourceFile': '',
29 'lineNumber': 0,
30 'columnNumber': 0,
31 'statusCode': 0
32 };
33 for (key in expectations)
34 assert_equals(expectations[key], e[key], key);
35 }));
36 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=2";
37 }, "Mixed images generate CSP violation reports in the presence of 'block-al l-mixed-content'.");
jww 2016/05/26 00:30:34 Would it be worth add a second test file for a rep
38 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698