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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html

Issue 198893002: Make supported-xml-content-types.html tests faster. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More splitting Created 6 years, 9 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/xmlhttprequest/supported-xml-content-types.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html b/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html
index 30ea214cb9547441010d74192cf9687c7b85c690..e8027b19bf8c98a7f23c609ca8ca3c201b9bad1e 100644
--- a/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html
+++ b/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html
@@ -1,37 +1,12 @@
+<!DOCTYPE HTML>
+<script src="/js-test-resources/js-test.js"></script>
+<script src="resources/supported-xml-content-types.js"></script>
<script>
+description("Test identification of XML content type in XHR responses.");
+window.jsTestIsAsync = true;
if (window.testRunner)
testRunner.dumpAsText();
-var request = new XMLHttpRequest();
-
-function getXMLOfType(type)
-{
- var escapedType = escape(type).replace(/\+/g, "^^PLUS^^"); // Perl CGI module seems replace + with a space
- request.open("GET", "supported-xml-content-types.cgi?type=" + escapedType, false);
- request.send(null);
- return request.responseXML;
-}
-
-function testXMLType(type, expected)
-{
- var xmlResult = getXMLOfType(type);
- var statusText = "FAIL (response type: " + request.getResponseHeader("Content-type") + ")";
-
- if (xmlResult) {
- statusText = "FAIL (got document -- response type: " + request.getResponseHeader("Content-type") + ")";
- var typeElement = xmlResult.firstChild;
- if (expected && typeElement) {
- if (typeElement.textContent == type)
- statusText = "PASS";
- else
- statusText = "FAIL (incorrect content: " + typeElement.textContent + " expected: " + type + ")";
- }
- } else if (!expected)
- statusText = "PASS";
-
- document.write("<p>" + statusText + " -- testing: " + type + " -- responseXML: " + xmlResult + "</p>");
-}
-
// valid types
testXMLType("text/xml", true);
testXMLType("image/svg+xml", true);
@@ -39,50 +14,12 @@ testXMLType("application/soap+xml", true);
testXMLType("foo/bar+xml", true);
testXMLType("123/BAR+xml", true);
-// They may be strange, but these should all be valid:
-testXMLType("foo_bar/baz+xml", true);
-testXMLType("foo-bar/baz+xml", true);
-testXMLType("foo+bar/baz+xml", true);
-testXMLType("foo~bar/baz+xml", true);
-testXMLType("foo!bar/baz+xml", true);
-testXMLType("foo$bar/baz+xml", true);
-testXMLType("foo^bar/baz+xml", true);
-testXMLType("foo{bar/baz+xml", true);
-testXMLType("foo}bar/baz+xml", true);
-testXMLType("foo|bar/baz+xml", true);
-testXMLType("foo%bar/baz+xml", true);
-testXMLType("foo'bar/baz+xml", true);
-testXMLType("foo`bar/baz+xml", true);
-testXMLType("foo#bar/baz+xml", true);
-testXMLType("foo&bar/baz+xml", true);
-testXMLType("foo*bar/baz+xml", true);
-
// non-xml types
testXMLType("text/html", false);
testXMLType("image/png", false);
-
// invalid types
testXMLType("invalid", false);
-// FIXME: our code intentionally skips spaces, that seems wrong to me.
-// https://bugs.webkit.org/show_bug.cgi?id=8644
-testXMLType("foo bar/baz+xml", false);
-
-testXMLType("foo[bar/baz+xml", false);
-testXMLType("foo]bar/baz+xml", false);
-testXMLType("foo(bar/baz+xml", false);
-testXMLType("foo)bar/baz+xml", false);
-testXMLType("foo<bar/baz+xml", false);
-testXMLType("foo>bar/baz+xml", false);
-testXMLType("foo@bar/baz+xml", false);
-testXMLType("foo,bar/baz+xml", false);
-testXMLType("foo;bar/baz+xml", false);
-testXMLType("foo:bar/baz+xml", false);
-testXMLType("foo\\bar/baz+xml", false);
-testXMLType('foo"bar/baz+xml', false);
-testXMLType("foo/bar/baz+xml", false);
-testXMLType("foo?bar/baz+xml", false);
-testXMLType("foo=bar/baz+xml", false);
-
+runNextTest();
</script>

Powered by Google App Engine
This is Rietveld 408576698