| Index: LayoutTests/http/tests/xmlhttprequest/post-formdata.html
|
| diff --git a/LayoutTests/http/tests/xmlhttprequest/post-formdata.html b/LayoutTests/http/tests/xmlhttprequest/post-formdata.html
|
| index afc52a0a3e86c2302ba73104bd8aa26ad0c54818..a654c53eed3725dd3e1b2be97bfa5dea5877fd82 100644
|
| --- a/LayoutTests/http/tests/xmlhttprequest/post-formdata.html
|
| +++ b/LayoutTests/http/tests/xmlhttprequest/post-formdata.html
|
| @@ -1,109 +1,3 @@
|
| <!DOCTYPE html>
|
| -
|
| <script src="/js-test-resources/js-test.js"></script>
|
| -<script>
|
| -description("Test verifies that FormData is sent correctly when using " +
|
| - "<a href='http://www.w3.org/TR/XMLHttpRequest/#the-send-method'>XMLHttpRequest asynchronously.</a>");
|
| -
|
| -var xhrFormDataTestUrl = '/xmlhttprequest/resources/multipart-post-echo.php';
|
| -var xhrFormDataTestCases = [{
|
| - data: { string: 'string value' },
|
| - result: "string=string value"
|
| -}, {
|
| - data: { bareBlob: new Blob(['blob-value']) },
|
| - result: 'bareBlob=blob:application/octet-stream:blob-value'
|
| -}, {
|
| - data: { bareBlob: new Blob(['blob-value']) },
|
| - beforeConstruct: function (t) { t.data.bareBlob.close(); },
|
| - result: 'bareBlob=blob:application/octet-stream:'
|
| -}, {
|
| - data: { bareBlob: new Blob(['blob-value']) },
|
| - beforeSend: function (t) { t.data.bareBlob.close(); },
|
| - result: 'bareBlob=blob:application/octet-stream:'
|
| -}, {
|
| - data: { mimeBlob: new Blob(['blob-value'], { type: 'text/html' }) },
|
| - result: 'mimeBlob=blob:text/html:blob-value'
|
| -}, {
|
| - data: {
|
| - namedBlob: {
|
| - value: new Blob(['blob-value']),
|
| - fileName: 'blob-file.txt'
|
| - }
|
| - },
|
| - result: 'namedBlob=blob-file.txt:application/octet-stream:blob-value'
|
| -}, {
|
| - data: { bareFile: new File(['file-value'], 'file-name.txt') },
|
| - result: 'bareFile=file-name.txt:application/octet-stream:file-value'
|
| -}, {
|
| - data: { bareFile: new File(['file-value'], 'file-name.txt') },
|
| - beforeConstruct: function (t) { t.data.bareFile.close(); },
|
| - result: 'bareFile=file-name.txt:application/octet-stream:'
|
| -}, {
|
| - data: { bareFile: new File(['file-value'], 'file-name.txt') },
|
| - beforeSend: function (t) { t.data.bareFile.close(); },
|
| - result: 'bareFile=file-name.txt:application/octet-stream:'
|
| -}, {
|
| - data: {
|
| - mimeFile: new File(['file-value'], 'file-name.html', { type: 'text/html' })
|
| - },
|
| - result: 'mimeFile=file-name.html:text/html:file-value'
|
| -}, {
|
| - data: {
|
| - renamedFile: {
|
| - value: new File(['file-value'], 'file-name.html', { type: 'text/html' }),
|
| - fileName: 'file-name-override.html'
|
| - }
|
| - },
|
| - result: 'renamedFile=file-name-override.html:text/html:file-value'
|
| -}];
|
| -
|
| -var xhr;
|
| -var expectedMimeType;
|
| -window.jsTestIsAsync = true;
|
| -var asyncTestCase = 0;
|
| -
|
| -function runNextAsyncTest() {
|
| - asyncTestCase++;
|
| - runAsyncTests();
|
| -}
|
| -
|
| -function reportResult(e) {
|
| - var testCase = xhrFormDataTestCases[asyncTestCase];
|
| - if (xhr.status === 200) {
|
| - echoResult = xhr.response;
|
| - shouldBeEqualToString("echoResult", testCase.result);
|
| - } else {
|
| - testFailed("Unknown error");
|
| - }
|
| -
|
| - runNextAsyncTest();
|
| -}
|
| -
|
| -function runAsyncTests() {
|
| - if (asyncTestCase >= xhrFormDataTestCases.length) {
|
| - finishJSTest();
|
| - return;
|
| - }
|
| -
|
| - var testCase = xhrFormDataTestCases[asyncTestCase];
|
| - var formData = new FormData();
|
| - if (testCase.beforeConstruct)
|
| - testCase.beforeConstruct(testCase);
|
| - for (var fieldName in testCase.data) {
|
| - fieldValue = testCase.data[fieldName];
|
| - if (fieldValue.constructor === Object)
|
| - formData.append(fieldName, fieldValue.value, fieldValue.fileName);
|
| - else
|
| - formData.append(fieldName, fieldValue);
|
| - }
|
| -
|
| - xhr = new XMLHttpRequest();
|
| - xhr.onloadend = reportResult;
|
| - xhr.open("POST", xhrFormDataTestUrl, true);
|
| - if (testCase.beforeSend)
|
| - testCase.beforeSend(testCase);
|
| - xhr.send(formData);
|
| -}
|
| -
|
| -runAsyncTests();
|
| -</script>
|
| +<script src="resources/post-formdata.js"></script>
|
|
|