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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html

Issue 2667303004: Move tests for DOMParser and XMLSerializer to dom/domparsing/. (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/domparser-parsefromstring-mimetype-support.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html b/third_party/WebKit/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
deleted file mode 100644
index 69540dadfdefff7d4d7ae3f8b94a72cd897c7fbf..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<style>
-.fail {
- color: red;
- font-weight: bold;
-}
-
-.pass {
- color: green;
- font-weight: bold;
-}
-</style>
-<script>
-var htmlContent =
- "<html>" +
- "<head>" +
- "<noscript>" +
- "Scripts must be disabled for the document created using DOMParser.parseFromString()" +
- "</noscript>" +
- "</head>" +
- "<body>" +
- "<div id='text'>Sample text content</div>" +
- "<script>document.getElementById('text').textContent = 'Modified text content';<\/script>" +
- "</body>" +
- "</html>";
-
-var xmlContent =
- "<root>" +
- "</root>";
-
-
-var xhtmlContent =
- "<!DOCTYPE html>" +
- "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
- "<head>" +
- "<title>Title of document</title>" +
- "<noscript>" +
- "Scripts must be disabled for the document created using DOMParser.parseFromString()" +
- "</noscript>" +
- "</head>" +
- "<body>" +
- "<div id='text'></div>" +
- "<script>document.getElementById('text').textContent = 'Newly added text';<\/script>" +
- "</body>" +
- "</html>";
-
-var svgImageContent =
- "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" +
- "<circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\"/>" +
- "</svg>";
-
-var xslContent =
- "<?xml version=\"1.0\"?>" +
- "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" +
- "<xsl:template match=\"/\">" +
- "<html>" +
- "<head>" +
- "<title>XML XSL Example</title>" +
- "<style type=\"text/css\">" +
- "body" +
- "{" +
- "background-color:red;" +
- "}" +
- "</style>" +
- "</head>" +
- "<body>" +
- "<xsl:apply-templates/>" +
- "</body>" +
- "</html>" +
- "</xsl:template>" +
- "" +
- "<xsl:template match=\"tutorial\">" +
- "<span><xsl:value-of select=\"name\"/></span>" +
- "<span><xsl:value-of select=\"url\"/></span>" +
- "</xsl:template>" +
- "</xsl:stylesheet>";
-
-var count = 0;
-
-function shouldSupport(content, mimeType)
-{
- var description = document.createElement("div");
- description.innerHTML = (++count) + ". Should support mime-type = \"" + mimeType + "\"";
- document.body.appendChild(description);
-
- var parser = new DOMParser();
- var resultDocument = parser.parseFromString(content, mimeType);
- if (!resultDocument) {
- var result = document.createElement("div");
- result.className = "fail";
- result.textContent = "FAIL";
- document.body.appendChild(result);
- } else {
- var content = document.createElement("div");
- var docElement = resultDocument.documentElement;
- if (mimeType.lastIndexOf("xml") === mimeType.length - 3)
- content.innerHTML = "Root element: " + docElement.tagName;
- else
- content.innerHTML = "HTML content:<br>" + docElement.innerHTML;
- document.body.appendChild(content);
-
- var result = document.createElement("div");
- result.className = "pass";
- result.textContent = "PASS";
- document.body.appendChild(result);
- }
- document.body.appendChild(document.createElement("br"));
-}
-
-function shouldThrowException(content, mimeType)
-{
- var description = document.createElement("div");
- description.innerHTML = (++count) + ". Should THROW exception for mime-type = \"" + mimeType + "\"";
- document.body.appendChild(description);
-
- var parser = new DOMParser();
- try {
- parser.parseFromString(content, mimeType);
- var result = document.createElement("div");
- result.className = "fail";
- result.textContent = "FAIL";
- document.body.appendChild(result);
- } catch (exception) {
- var message = document.createElement("div");
- message.className = "pass";
- message.textContent = exception;
- document.body.appendChild(message);
- var result = document.createElement("div");
- result.className = "pass";
- result.textContent = "PASS";
- document.body.appendChild(result);
- }
- document.body.appendChild(document.createElement("br"));
-}
-
-function runTest()
-{
- if (window.testRunner) {
- testRunner.dumpAsText();
- }
- shouldSupport(htmlContent, "text/html");
- shouldSupport(xmlContent, "text/xml");
- shouldSupport(xmlContent, "application/xml");
- shouldSupport(xhtmlContent, "application/xhtml+xml");
- shouldSupport(svgImageContent, "image/svg+xml");
- shouldThrowException(xslContent, "text/xsl");
- shouldThrowException(xmlContent, "text/dummy+xml");
- shouldThrowException(xmlContent, "text/XML");
- shouldThrowException(xmlContent, "TEXT/html");
-}
-</script>
-</head>
-<body onload="runTest();">
-<p>This tests DOMParser supports creating Document for HTML content with mime-type "text/html".</p>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698