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

Unified Diff: LayoutTests/http/tests/dom/document-contentType-xhr.html

Issue 151653004: Implemented Document.contentType (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 6 years, 10 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/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..d01be099ce9158bd7615e1c53fc8382ee7a793ab
--- /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 toTest = [
+ { 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 onrequestload(expectedMimeType) {
+ shouldBeEqualToNumber('xhr.status', 200);
+
+ if (xhr.responseXML)
+ shouldBeEqualToString('xhr.responseXML.contentType', expectedMimeType);
+ else
+ testFailed("Null document for mime-type " + expectedMimeType);
+
+ stepTest();
+}
+
+var xhr;
+
+function stepTest() {
+ var thisTest = toTest.shift();
+ if (thisTest) {
+ xhr = new XMLHttpRequest();
+ xhr.open('GET', thisTest.uri, true);
+ xhr.responseType = 'document';
+ xhr.onload = onrequestload.bind(null, thisTest.mt);
+ xhr.send('');
+ }
arv (Not doing code reviews) 2014/03/24 16:20:11 } else {
+ else
+ finishJSTest();
+}
+
+stepTest();
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698