Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html

Issue 57483002: Implement File constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Answered feedback, part 2. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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");

Powered by Google App Engine
This is Rietveld 408576698