OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>FileAPI Test: Creating Blob URL via XMLHttpRequest</title> |
| 4 <link rel="author" title="Intel" href="http://www.intel.com"> |
| 5 <link rel="author" title="JunChen Xia" href="mailto:xjconlyme@gmail.com"> |
| 6 <script src="../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> |
| 8 |
| 9 <div id="log"></div> |
| 10 |
| 11 <script> |
| 12 async_test(function () { |
| 13 var http = new XMLHttpRequest(); |
| 14 http.open("GET", "/images/blue96x96.png", true); |
| 15 http.responseType = "blob"; |
| 16 http.onloadend = this.step_func(function(evt) { |
| 17 var blobURI = window.URL.createObjectURL(http.response); |
| 18 assert_true(http.response instanceof Blob, "XMLHttpRequest returns instanc
eof Blob"); |
| 19 assert_equals(typeof blobURI, "string", "Blob URI is typeof string"); |
| 20 assert_equals(blobURI.indexOf("blob"), 0, "Blob URI starts with 'blob'"); |
| 21 assert_equals(http.status, 200, "The status is 200"); |
| 22 assert_equals(http.statusText, "OK", "The status text is OK when XMLHttpRe
quest returns correct blob"); |
| 23 assert_equals(http.getResponseHeader("Content-Type"), "image/png", "The co
ntent type is image/png when set the respnose blob"); |
| 24 this.done(); |
| 25 }); |
| 26 http.send(); |
| 27 }); |
| 28 </script> |
| 29 |
OLD | NEW |