Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..58da544df6fd26304b4fd06de58d63676880df52 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html |
| @@ -0,0 +1,42 @@ |
| +<!DOCTYPE HTML> |
| +<meta http-equiv="Content-Security-Policy" content="img-src 'self' {{domains[www]}}:{{ports[http][0]}}"> |
| +<html> |
| +<head> |
| + <title>img element src attribute must match src list.</title> |
| + <script src='/resources/testharness.js'></script> |
| + <script src='/resources/testharnessreport.js'></script> |
| +</head> |
| +<body> |
| + <div id='log'/> |
| + |
| + <script> |
| + async_test(function(t) { |
| + i = new Image(); |
| + i.onload = t.step_func_done(function() { |
| + assert_equals(168, i.naturalWidth); |
| + assert_equals(64, i.naturalHeight); |
| + }); |
| + i.onerror = t.unreached_func("The img should have loaded"); |
| + i.src = '/content-security-policy/support/pass.png'; |
| + }, "img-src for relative path should load"); |
| + |
| + async_test(function(t) { |
| + i = new Image(); |
| + i.onload = t.unreached_func("Image from unapproved domain was loaded."); |
| + i.onerror = t.step_func_done(); |
| + i.src = 'http://www1.web-platform.test/content-security-policy/support/fail.png'; |
|
Mike West
2017/03/23 10:19:35
{{domains[www1]}}
|
| + }, "img-src from unapproved domains should not load"); |
| + |
| + async_test(function(t) { |
| + i = new Image(); |
| + i.onload = t.step_func_done(function() { |
| + assert_equals(168, i.naturalWidth); |
| + assert_equals(64, i.naturalHeight); |
| + }); |
| + i.onerror = t.unreached_func("The img should have loaded"); |
| + i.src = location.protocol + '//www.' + location.hostname + ':' + location.port + |
|
Mike West
2017/03/23 10:19:36
{{domains[www]}}
|
| + '/content-security-policy/support/pass.png'; |
| + }, "img-src from approved domains should load"); |
| + </script> |
| +</body> |
| +</html> |