Chromium Code Reviews| Index: LayoutTests/http/tests/dom/document-contentType-xhr.html |
| diff --git a/LayoutTests/http/tests/dom/document-contentType-xhr.html b/LayoutTests/http/tests/dom/document-contentType-xhr.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6b88756877e4c161caa573b37392ce7f7c38e11e |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/dom/document-contentType-xhr.html |
| @@ -0,0 +1,47 @@ |
| +<!DOCTYPE html> |
| +<title>document.contentType</title> |
| +<link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype"> |
| +<script src="/js-test-resources/js-test.js"></script> |
| +<body> |
| + |
| +<script> |
| +window.jsTestIsAsync = true; |
| + |
| +var to_test = [ |
| + { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html" }, |
| + { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml" }, |
| + { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xml" }, |
| + { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html;charset=utf-8" }, |
| + { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml;charset=utf-8" }, |
| + { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xml;charset=utf-8" } |
| +]; |
| + |
| +function _(s) { return '"' + s + '"'; }; |
|
arv (Not doing code reviews)
2014/02/11 16:36:10
Use descriptive names
|
| + |
| +function onrequestload(expected_mt) { |
| + shouldBe(_(this.status), _(200)); |
| + |
| + if (this.responseXML) |
| + shouldBe(_(this.responseXML.contentType), _(expected_mt)); |
| + else |
| + testFailed("Null document for mime-type " + expected_mt); |
| + |
| + step_test(); |
| +} |
| + |
| +function step_test() { |
| + var this_test = to_test.shift(); |
| + if (this_test) { |
| + var x = new XMLHttpRequest(); |
| + x.open('GET', this_test.uri, true); |
| + x.responseType = 'document'; |
| + x.onload = onrequestload.bind(x, this_test.mt); |
| + x.send(''); |
| + } |
| + else |
| + finishJSTest(); |
| +} |
| + |
| +step_test(); |
| + |
| +</script> |