Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>document.contentType</title> | |
| 3 <link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype"> | |
| 4 <script src="/js-test-resources/js-test.js"></script> | |
| 5 <body> | |
| 6 | |
| 7 <script> | |
| 8 window.jsTestIsAsync = true; | |
| 9 | |
| 10 var to_test = [ | |
|
arv (Not doing code reviews)
2014/02/21 15:43:53
no underscores please
| |
| 11 { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html" }, | |
| 12 { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml" }, | |
| 13 { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xm l" }, | |
| 14 { mt: "text/html", uri: "resources/send-mime-type.php?m=text/html;charset=ut f-8" }, | |
| 15 { mt: "text/xml", uri: "resources/send-mime-type.php?m=text/xml;charset=utf- 8" }, | |
| 16 { mt: "application/xml", uri: "resources/send-mime-type.php?m=application/xm l;charset=utf-8" } | |
| 17 ]; | |
| 18 | |
| 19 function onrequestload(expected_mt) { | |
| 20 shouldBeEqualToNumber('xhr.status', 200); | |
| 21 | |
| 22 if (xhr.responseXML) | |
| 23 shouldBeEqualToString('xhr.responseXML.contentType', expected_mt); | |
| 24 else | |
| 25 testFailed("Null document for mime-type " + expected_mt); | |
| 26 | |
| 27 step_test(); | |
| 28 } | |
| 29 | |
| 30 var xhr; | |
| 31 | |
| 32 function step_test() { | |
| 33 var this_test = to_test.shift(); | |
| 34 if (this_test) { | |
| 35 xhr = new XMLHttpRequest(); | |
| 36 xhr.open('GET', this_test.uri, true); | |
| 37 xhr.responseType = 'document'; | |
| 38 xhr.onload = onrequestload.bind(null, this_test.mt); | |
| 39 xhr.send(''); | |
| 40 } | |
| 41 else | |
| 42 finishJSTest(); | |
| 43 } | |
| 44 | |
| 45 step_test(); | |
| 46 | |
| 47 </script> | |
| OLD | NEW |