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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html

Issue 2763253002: Fixed external wpt csp img-src/* tests. (Closed)
Patch Set: Switched to placeholders instead of hardcoded URLs Created 3 years, 9 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 <meta http-equiv="Content-Security-Policy" content="img-src 'self' {{domains[www ]}}:{{ports[http][0]}}">
3 <html>
4 <head>
5 <title>img element src attribute must match src list.</title>
6 <script src='/resources/testharness.js'></script>
7 <script src='/resources/testharnessreport.js'></script>
8 </head>
9 <body>
10 <div id='log'/>
11
12 <script>
13 async_test(function(t) {
14 i = new Image();
15 i.onload = t.step_func_done(function() {
16 assert_equals(i.naturalWidth, 168);
qyearsley 2017/03/23 18:00:40 It appears that sometimes this may be zero on some
17 assert_equals(i.naturalHeight, 64);
18 });
19 i.onerror = t.unreached_func("The img should have loaded");
20 i.src = '/content-security-policy/support/pass.png';
21 }, "img-src for relative path should load");
22
23 async_test(function(t) {
24 i = new Image();
25 i.onload = t.unreached_func("Image from unapproved domain was loaded.");
26 i.onerror = t.step_func_done();
27 i.src = 'http://{{domains[www1]}}/content-security-policy/support/fail.p ng';
28 }, "img-src from unapproved domains should not load");
29
30 async_test(function(t) {
31 i = new Image();
32 i.onload = t.step_func_done(function() {
33 assert_equals(i.naturalWidth, 168);
34 assert_equals(i.naturalHeight, 64);
35 });
36 i.onerror = t.unreached_func("The img should have loaded");
37 i.src = location.protocol + '//{{domains[www]}}:{{ports[http][0]}}/conte nt-security-policy/support/pass.png';
38 }, "img-src from approved domains should load");
39 </script>
40 </body>
41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698