| OLD | NEW |
| 1 <!DOCTYPE html> | |
| 2 | |
| 3 <script src="/js-test-resources/js-test.js"></script> | |
| 4 <script> | |
| 5 description("Test verifies that FormData is sent correctly when using " + | 1 description("Test verifies that FormData is sent correctly when using " + |
| 6 "<a href='http://www.w3.org/TR/XMLHttpRequest/#the-send-method'>XMLH
ttpRequest asynchronously.</a>"); | 2 "<a href='http://www.w3.org/TR/XMLHttpRequest/#the-send-method'>XMLH
ttpRequest asynchronously.</a>"); |
| 7 | 3 |
| 8 var xhrFormDataTestUrl = '/xmlhttprequest/resources/multipart-post-echo.php'; | 4 var xhrFormDataTestUrl = '/xmlhttprequest/resources/multipart-post-echo.php'; |
| 9 var xhrFormDataTestCases = [{ | 5 var xhrFormDataTestCases = [{ |
| 10 data: { string: 'string value' }, | 6 data: { string: 'string value' }, |
| 11 result: "string=string value" | 7 result: "string=string value" |
| 12 }, { | 8 }, { |
| 13 data: { bareBlob: new Blob(['blob-value']) }, | 9 data: { bareBlob: new Blob(['blob-value']) }, |
| 14 result: 'bareBlob=blob:application/octet-stream:blob-value' | 10 result: 'bareBlob=blob:application/octet-stream:blob-value' |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 renamedFile: { | 48 renamedFile: { |
| 53 value: new File(['file-value'], 'file-name.html', { type: 'text/html
' }), | 49 value: new File(['file-value'], 'file-name.html', { type: 'text/html
' }), |
| 54 fileName: 'file-name-override.html' | 50 fileName: 'file-name-override.html' |
| 55 } | 51 } |
| 56 }, | 52 }, |
| 57 result: 'renamedFile=file-name-override.html:text/html:file-value' | 53 result: 'renamedFile=file-name-override.html:text/html:file-value' |
| 58 }]; | 54 }]; |
| 59 | 55 |
| 60 var xhr; | 56 var xhr; |
| 61 var expectedMimeType; | 57 var expectedMimeType; |
| 62 window.jsTestIsAsync = true; | 58 |
| 59 self.jsTestIsAsync = true; |
| 63 var asyncTestCase = 0; | 60 var asyncTestCase = 0; |
| 64 | 61 |
| 65 function runNextAsyncTest() { | 62 function runNextAsyncTest() { |
| 66 asyncTestCase++; | 63 asyncTestCase++; |
| 67 runAsyncTests(); | 64 runAsyncTests(); |
| 68 } | 65 } |
| 69 | 66 |
| 70 function reportResult(e) { | 67 function reportResult(e) { |
| 71 var testCase = xhrFormDataTestCases[asyncTestCase]; | 68 var testCase = xhrFormDataTestCases[asyncTestCase]; |
| 72 if (xhr.status === 200) { | 69 if (xhr.status === 200) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 99 | 96 |
| 100 xhr = new XMLHttpRequest(); | 97 xhr = new XMLHttpRequest(); |
| 101 xhr.onloadend = reportResult; | 98 xhr.onloadend = reportResult; |
| 102 xhr.open("POST", xhrFormDataTestUrl, true); | 99 xhr.open("POST", xhrFormDataTestUrl, true); |
| 103 if (testCase.beforeSend) | 100 if (testCase.beforeSend) |
| 104 testCase.beforeSend(testCase); | 101 testCase.beforeSend(testCase); |
| 105 xhr.send(formData); | 102 xhr.send(formData); |
| 106 } | 103 } |
| 107 | 104 |
| 108 runAsyncTests(); | 105 runAsyncTests(); |
| 109 </script> | |
| OLD | NEW |