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

Unified Diff: LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html

Issue 183883004: Let ContentSecurityPolicy shared between imports and the master. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Adding guardRef()/guardDeref() Created 6 years, 10 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: LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html
diff --git a/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html b/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html
index f387d634ef6ba2405a3c2d1c187a2a7777b3c4a8..18e6eac7bb6595622fe97aaec28a3707c602273f 100644
--- a/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html
+++ b/LayoutTests/http/tests/htmlimports/csp-import-block-but-nonce.html
@@ -1,21 +1,30 @@
<!DOCTYPE html>
<html>
<head>
-<script>
-</script>
-<link id="target" rel="import" href="resources/having-nonce-policy.html">
-<script src="/js-test-resources/js-test.js"></script>
+<meta http-equiv="Content-Security-Policy" content="script-src http://localhost:8000 'nonce-hello'">
+<link id="target" rel="import" href="http://localhost:8000/htmlimports/resources/having-nonce-policy.cgi">
</head>
<body>
-<script>
-shouldBe("document.inlineScriptHasRun", "undefined");
-shouldBe("document.externalScriptHasRun", "undefined");
-shouldBeTrue("document.externalScriptWithNonceHasRun");
-shouldBeTrue("document.inlineScriptWithNonceHasRun");
-shouldBe("document.evalFromInlineHasRun", "undefined");
-shouldBe("document.evalFromExternalHasRun", "undefined");
-shouldBe("document.evalFromInlineWithNonceHasRun", "undefined");
-shouldBe("document.evalFromExternalWithNonceHasRun", "undefined");
+<script nonce="hello">
+function test(actual, expected, message)
+{
+ if (actual === expected)
+ console.log("PASS");
+ else
+ console.log("FAIL:" + message);
+}
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+test(document.inlineScriptHasRun, undefined, "document.inlineScriptHasRun");
+test(document.externalScriptHasRun, undefined, "document.externalScriptHasRun");
+test(document.externalScriptWithNonceHasRun, true, "document.externalScriptWithNonceHasRun");
+test(document.inlineScriptWithNonceHasRun, true, "document.inlineScriptWithNonceHasRun");
+test(document.evalFromInlineHasRun, undefined, "document.evalFromInlineHasRun");
+test(document.evalFromExternalHasRun, undefined, "document.evalFromExternalHasRun");
+test(document.evalFromInlineWithNonceHasRun, undefined, "document.evalFromInlineWithNonceHasRun");
+test(document.evalFromExternalWithNonceHasRun, undefined, "document.evalFromExternalWithNonceHasRun");
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698