Chromium Code Reviews

Unified Diff: LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html

Issue 399653002: Rework CORS <link rel=stylesheet> tests as js-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html
diff --git a/LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html b/LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html
index c4bd3b7f42ae0525bc51c529b871d4d7db979c17..544ae72e69de441bf9b36a8f539bbff4b7d47d06 100644
--- a/LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html
+++ b/LayoutTests/http/tests/security/link-crossorigin-stylesheet-anonymous.html
@@ -1,24 +1,35 @@
<!DOCTYPE HTML>
-<p>Test that a linked stylesheet with a crossorigin=anonymous attribute loads a CORS enabled resource.</p>
-<pre></pre>
+<html>
+<head>
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+description("Test that a linked stylesheet with a crossorigin=anonymous attribute loads a CORS enabled resource.");
+</script>
<script src="resources/link-crossorigin-common.js"></script>
+</head>
<link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/security/resources/green-background-allow-star.php" onload="pass()" onerror="fail()">
<link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/security/resources/green-background-allow-credentials.php" onload="pass()" onerror="fail()">
<script>
-// Test that dynamically inserted <link> elements are handled the same way.
-var link = document.createElement("link");
-link.rel = "stylesheet";
-link.crossOrigin = "anonymous";
-link.onload = pass;
-link.onerror = fail;
-link.href = "http://localhost:8080/security/resources/green-background-allow-star.php";
-document.body.appendChild(link);
+function runTest()
+{
+ // Test that dynamically inserted <link> elements are handled the same way.
+ var link = document.createElement("link");
+ link.rel = "stylesheet";
+ link.crossOrigin = "anonymous";
+ link.onload = pass;
+ link.onerror = fail;
+ link.href = "http://localhost:8080/security/resources/green-background-allow-star.php";
+ document.body.appendChild(link);
-link = document.createElement("link");
-link.rel = "stylesheet";
-link.crossOrigin = "use-credentials";
-link.onload = pass;
-link.onerror = fail;
-link.href = "http://localhost:8080/security/resources/green-background-allow-credentials.php";
-document.body.appendChild(link);
+ link = document.createElement("link");
+ link.rel = "stylesheet";
+ link.crossOrigin = "use-credentials";
+ link.onload = pass;
+ link.onerror = fail;
+ link.href = "http://localhost:8080/security/resources/green-background-allow-credentials.php";
+ document.body.appendChild(link);
+}
+window.onload = runTest;
</script>
+</body>
+</html>

Powered by Google App Engine