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/HTMLAnchorElement/set-href-attribute-port.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/HTMLAnchorElement/set-href-attribute-port.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-port.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-port.html
index 852148e9de3f4a3c6b4ad32b80e6969e5d192653..f297331bd48006d3e05b44132e287b24d97e267a 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-port.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-port.html
@@ -4,6 +4,54 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/set-href-attribute-port.js"></script>
+<script>
+description('Test setting the port attribute of the URL in HTMLAnchorElement.');
+
+var a = document.createElement('a');
+
+debug("Default port as number");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = 443;
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
+
+debug("Default port as string");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "443";
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
+
+debug("Set port to 0");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "0";
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if any character is not a digit.
+debug("Set port to non-number");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "4a";
+shouldBe("a.href", "'https://www.mydomain.com:4/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug("Set port to null");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = null;
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug("Set port to empty string");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "";
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+debug("Set port to undefined");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = undefined;
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not allow setting the port on a URL with protocol foo: .
+debug("Set port to URL with foo: protocol");
+a.href = "foo://bar/";
+a.port = 50;
+shouldBe("a.href", "'foo://bar:50/'");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698