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

Unified 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 side-by-side diff with in-line comments
Download patch
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..602260fc40b4b2a5af715e9d2ff82a794caccce1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/img-src/img-src-4_1.sub.html
@@ -0,0 +1,41 @@
+<!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(i.naturalWidth, 168);
qyearsley 2017/03/23 18:00:40 It appears that sometimes this may be zero on some
+ assert_equals(i.naturalHeight, 64);
+ });
+ 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://{{domains[www1]}}/content-security-policy/support/fail.png';
+ }, "img-src from unapproved domains should not load");
+
+ async_test(function(t) {
+ i = new Image();
+ i.onload = t.step_func_done(function() {
+ assert_equals(i.naturalWidth, 168);
+ assert_equals(i.naturalHeight, 64);
+ });
+ i.onerror = t.unreached_func("The img should have loaded");
+ i.src = location.protocol + '//{{domains[www]}}:{{ports[http][0]}}/content-security-policy/support/pass.png';
+ }, "img-src from approved domains should load");
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698