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 if (this.self) | |
arv (Not doing code reviews)
2014/04/07 21:16:38
This is always true.
window === self
window === t
| |
60 self.jsTestIsAsync = true; | |
61 else | |
62 window.jsTestIsAsync = true; | |
63 var asyncTestCase = 0; | 63 var asyncTestCase = 0; |
64 | 64 |
65 function runNextAsyncTest() { | 65 function runNextAsyncTest() { |
66 asyncTestCase++; | 66 asyncTestCase++; |
67 runAsyncTests(); | 67 runAsyncTests(); |
68 } | 68 } |
69 | 69 |
70 function reportResult(e) { | 70 function reportResult(e) { |
71 var testCase = xhrFormDataTestCases[asyncTestCase]; | 71 var testCase = xhrFormDataTestCases[asyncTestCase]; |
72 if (xhr.status === 200) { | 72 if (xhr.status === 200) { |
(...skipping 26 matching lines...) Expand all Loading... | |
99 | 99 |
100 xhr = new XMLHttpRequest(); | 100 xhr = new XMLHttpRequest(); |
101 xhr.onloadend = reportResult; | 101 xhr.onloadend = reportResult; |
102 xhr.open("POST", xhrFormDataTestUrl, true); | 102 xhr.open("POST", xhrFormDataTestUrl, true); |
103 if (testCase.beforeSend) | 103 if (testCase.beforeSend) |
104 testCase.beforeSend(testCase); | 104 testCase.beforeSend(testCase); |
105 xhr.send(formData); | 105 xhr.send(formData); |
106 } | 106 } |
107 | 107 |
108 runAsyncTests(); | 108 runAsyncTests(); |
109 </script> | |
OLD | NEW |