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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.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-async.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.html b/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.html
index 536d19550447192699af4c8ab8a1eda4d7848dcc..1f61aca3a09ef564bc0b40561c9a416d0b8177f2 100644
--- a/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.html
+++ b/LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.html
@@ -21,10 +21,11 @@
}
function reportResult(e) {
+ var testCase = xhrBlobTestCases[asyncTestCase];
if (xhr.status === 200) {
- expectedMimeType = JSON.parse(xhr.response)['content-type'] || "";
- shouldBeEqualToString("expectedMimeType", xhrBlobTestCases[asyncTestCase].expectedMime);
- } else if (xhr.status === 0 && xhrBlobTestCases[asyncTestCase].shouldThrow){
+ postedMimeType = JSON.parse(xhr.response)['content-type'] || "";
+ shouldBeEqualToString("postedMimeType", testCase.expectedMime);
+ } else if (xhr.status === 0 && testCase.shouldThrow){
testPassed("Cross-origin request without CORS headers should fail.");
} else {
testFailed("Unknown error");
@@ -38,12 +39,14 @@
finishJSTest();
return;
} else {
- var mime = xhrBlobTestCases[asyncTestCase].mime;
- var url = xhrBlobTestCases[asyncTestCase].url !== undefined ? xhrBlobTestCases[asyncTestCase].url + xhrBlobTestUrl : xhrBlobTestUrl;
- url += xhrBlobTestCases[asyncTestCase].allowOrigin || "";
- if (xhrBlobTestCases[asyncTestCase].shouldThrow !== undefined) {
+ var testCase = xhrBlobTestCases[asyncTestCase];
+ var mime = testCase.mime;
+ var file = testCase.file;
+ var url = testCase.url !== undefined ? testCase.url + xhrBlobTestUrl : xhrBlobTestUrl;
+ url += testCase.allowOrigin || "";
+ if (testCase.shouldThrow !== undefined) {
try {
- testBlobContentTypeAsync(url, mime);
+ testBlobContentTypeAsync(url, mime, file);
} catch (e) {
testPassed("Exception should be thrown.")
runNextAsyncTest();
@@ -53,12 +56,19 @@
}
}
- function testBlobContentTypeAsync(url, mimeType) {
+ function testBlobContentTypeAsync(url, mimeType, fileName) {
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.onloadend = reportResult;

Powered by Google App Engine
This is Rietveld 408576698