Index: LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html b/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html |
index dadf2c6c88cfa25c8a01fbba37cabfe6e285480d..a3ccaefbeb4a063d0775403ffe0d6c811a8f38bd 100644 |
--- a/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html |
+++ b/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html |
@@ -16,35 +16,44 @@ |
function runSyncTests() { |
var testCount = xhrBlobTestCases.length; |
for (var i = 0; i < testCount; i++) { |
- var mime = xhrBlobTestCases[i].mime; |
- var expectedMime = xhrBlobTestCases[i].expectedMime; |
- var url = xhrBlobTestCases[i].url !== undefined ? xhrBlobTestCases[i].url + xhrBlobTestUrl : xhrBlobTestUrl; |
- url += xhrBlobTestCases[i].allowOrigin || ""; |
- if (xhrBlobTestCases[i].shouldThrow !== undefined) { |
+ var testCase = xhrBlobTestCases[i]; |
+ var mime = testCase.mime; |
+ var file = testCase.file; |
+ var expectedMime = testCase.expectedMime; |
+ var url = testCase.url !== undefined ? testCase.url + xhrBlobTestUrl : xhrBlobTestUrl; |
+ url += testCase.allowOrigin || ""; |
+ if (testCase.shouldThrow !== undefined) { |
try { |
- testBlobContentTypeSync(url, mime, expectedMime); |
+ testBlobContentTypeSync(url, file, mime, expectedMime); |
} catch (e) { |
testPassed("Exception should be thrown.") |
} |
} else { |
- testBlobContentTypeSync(url, mime, expectedMime); |
+ testBlobContentTypeSync(url, file, mime, expectedMime); |
} |
} |
} |
- function testBlobContentTypeSync(url, mimeType, expectedMime) { |
+ function testBlobContentTypeSync(url, fileName, mimeType, expectedMime) { |
var blob; |
- if (mimeType !== "") |
- blob = new Blob(["Test content"], {type: mimeType}); |
- else |
- blob = new Blob(["Test content"]); |
+ if (fileName) { |
+ if (mimeType !== "") |
+ blob = new File(["Test content"], fileName, {type: mimeType}); |
+ else |
+ blob = new File(["Test content"], fileName); |
+ } else { |
+ if (mimeType !== "") |
+ blob = new Blob(["Test content"], {type: mimeType}); |
+ else |
+ blob = new Blob(["Test content"]); |
+ } |
xhr = new XMLHttpRequest(); |
xhr.open("POST", url, false); |
xhr.send(blob); |
if (xhr.status === 200) { |
- expectedMimeType = JSON.parse(xhr.response)['content-type'] || ""; |
- shouldBeEqualToString("expectedMimeType", expectedMime); |
+ postedMimeType = JSON.parse(xhr.response)['content-type'] || ""; |
+ shouldBeEqualToString("postedMimeType", expectedMime); |
} else |
testFailed("Unknown error"); |