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..0c3b23e19d26a8fce1ed9fbc822e36e975558411 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html |
| @@ -0,0 +1,38 @@ |
| +<!DOCTYPE HTML> |
| +<meta http-equiv="Content-Security-Policy" content="img-src 'self' www.{{host}}:{{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> |
| + var t1 = async_test("img-src for relative path should load."); |
| + var t2 = async_test("img-src from unapproved domains should not load"); |
| + var t3 = async_test("img-src from approved domains should load"); |
| + </script> |
| + |
| + <img src='/content-security-policy/support/pass.png' |
| + onload='t1.done();' |
| + onerror='t1.step(function() { assert_unreached("The img should have loaded."); t1.done() });'> |
| + |
| + |
| + <img src='http://www1.web-platform.test/content-security-policy/support/fail.png' |
| + onload='t2.step(function() { assert_unreached("Image from unapproved domain was loaded."); t2.done()} );' |
| + onerror='t2.done();'> |
| + |
| + <div id='t3'></div> |
| + <script> |
| + var t3img = document.createElement('img'); |
| + t3img.onload = function() {t3.done();} |
| + t3img.onerror = function() {t3.step(function() { assert_unreached(); t3.done();})} |
| + t3img.src = location.protocol + '//www.' + location.hostname + ':' + location.port + |
| + '/content-security-policy/support/pass.png'; |
| + var t3div = document.getElementById('t3'); |
| + t3div.appendChild(t3img); |
| + </script> |
| +</body> |
| +</html> |
|
Mike West
2017/03/22 11:56:22
As long as you're rewriting the test, I'd suggest
andypaicu
2017/03/23 09:22:10
done
|