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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Window/invalid-protocol.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 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/fast/dom/Window/invalid-protocol.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/invalid-protocol.html b/third_party/WebKit/LayoutTests/fast/dom/Window/invalid-protocol.html
index 89f98f52b52d8258150f64a91ced2613d9be4057..78aee49edcf3b200a3a9257f766a3cf3d30946c2 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/invalid-protocol.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/invalid-protocol.html
@@ -4,6 +4,34 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/invalid-protocol.js"></script>
+<script>
+description("Test URL protocol setter.");
+
+var a = document.createElement("a");
+a.setAttribute("href", "http://www.apple.com/");
+document.body.appendChild(a);
+
+shouldThrow("location.protocol = ''", '"SyntaxError: Failed to set the \'protocol\' property on \'Location\': \'\' is an invalid protocol."');
+shouldThrow("location.protocol = ':'", '"SyntaxError: Failed to set the \'protocol\' property on \'Location\': \':\' is an invalid protocol."');
+shouldThrow("location.protocol = 'é'", '"SyntaxError: Failed to set the \'protocol\' property on \'Location\': \'é\' is an invalid protocol."');
+shouldThrow("location.protocol = '['", '"SyntaxError: Failed to set the \'protocol\' property on \'Location\': \'[\' is an invalid protocol."');
+shouldThrow("location.protocol = '0'", '"SyntaxError: Failed to set the \'protocol\' property on \'Location\': \'0\' is an invalid protocol."');
+
+// IE raises exceptions for anchors, too - but Firefox does not. In either case, protocol shouldn't change.
+try { a.protocol = '' } catch (ex) { }
+try { a.protocol = 'é' } catch (ex) { }
+try { a.protocol = '[' } catch (ex) { }
+try { a.protocol = '0' } catch (ex) { }
+shouldBe("a.protocol", "'http:'");
+
+a.protocol = "https";
+shouldBe("a.href", "'https://www.apple.com/'");
+
+a.protocol = "http:";
+shouldBe("a.href", "'http://www.apple.com/'");
+
+a.protocol = "https://foobar";
+shouldBe("a.href", "'https://www.apple.com/'");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698