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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/URL-attribute-reflection.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/URL-attribute-reflection.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/URL-attribute-reflection.html b/third_party/WebKit/LayoutTests/fast/dom/URL-attribute-reflection.html
index 4b54efb8db07947ffc48db0974a819f1512301c5..9a802f99661b7f6bee76ef58744ac0c9b5d09581 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/URL-attribute-reflection.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/URL-attribute-reflection.html
@@ -4,6 +4,74 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/URL-attribute-reflection.js"></script>
+<script>
+description("Test reflecting URL attributes with empty string values.");
+
+function testURLReflection(attributeName, tag, scriptAttributeName)
+{
+ if (!scriptAttributeName)
+ scriptAttributeName = attributeName.toLowerCase();
+
+ var element;
+ if (tag === "html")
+ element = document.documentElement;
+ else {
+ element = document.createElement(tag);
+ document.body.appendChild(element);
+ }
+ element.setAttribute(scriptAttributeName, "x");
+ var xValue = element[attributeName];
+ element.setAttribute(scriptAttributeName, "");
+ var emptyValue = element[attributeName];
+ if (tag !== "html")
+ document.body.removeChild(element);
+
+ if (xValue === undefined)
+ return "none";
+ if (xValue === "x")
+ return "non-URL";
+ if (xValue !== document.baseURI.replace(/[^\/]+$/, "x"))
+ return "error (x): " + xValue;
+ if (emptyValue === "")
+ return "non-empty URL";
+ if (emptyValue === document.baseURI)
+ return "URL";
+ return "error (empty): " + emptyValue;
+}
+
+shouldBe("testURLReflection('attribute', 'element')", "'none'");
+shouldBe("testURLReflection('id', 'element')", "'non-URL'");
+
+// The following list comes from the HTML5 document’s attributes index.
+// These are the URL attributes from that list.
+
+shouldBe("testURLReflection('action', 'form')", "'URL'");
+shouldBe("testURLReflection('cite', 'blockquote')", "'URL'");
+shouldBe("testURLReflection('cite', 'del')", "'URL'");
+shouldBe("testURLReflection('cite', 'ins')", "'URL'");
+shouldBe("testURLReflection('cite', 'q')", "'URL'");
+shouldBe("testURLReflection('data', 'object')", "'URL'");
+shouldBe("testURLReflection('formaction', 'button')", "'URL'");
+shouldBe("testURLReflection('formaction', 'input')", "'URL'");
+shouldBe("testURLReflection('href', 'a')", "'URL'");
+shouldBe("testURLReflection('href', 'area')", "'URL'");
+shouldBe("testURLReflection('href', 'link')", "'URL'");
+shouldBe("testURLReflection('href', 'base')", "'URL'");
+shouldBe("testURLReflection('icon', 'command')", "'URL'");
+shouldBe("testURLReflection('poster', 'video')", "'URL'");
+shouldBe("testURLReflection('src', 'audio')", "'URL'");
+shouldBe("testURLReflection('src', 'embed')", "'URL'");
+shouldBe("testURLReflection('src', 'iframe')", "'URL'");
+shouldBe("testURLReflection('src', 'img')", "'URL'");
+shouldBe("testURLReflection('src', 'input')", "'URL'");
+shouldBe("testURLReflection('src', 'script')", "'URL'");
+shouldBe("testURLReflection('src', 'source')", "'URL'");
+shouldBe("testURLReflection('src', 'video')", "'URL'");
+
+// Other reflected URL attributes.
+
+shouldBe("testURLReflection('longDesc', 'img')", "'URL'");
+shouldBe("testURLReflection('lowsrc', 'img')", "'URL'");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698