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

Side by Side Diff: LayoutTests/http/tests/fetch/script-tests/response.js

Issue 1068783005: {Request, Response}.blob() should release its lock when resolved. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@request-body-setting
Patch Set: Created 5 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/request.js ('k') | Source/modules/fetch/Body.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('../resources/fetch-test-helpers.js'); 2 importScripts('../resources/fetch-test-helpers.js');
3 } 3 }
4 4
5 function consume(reader) { 5 function consume(reader) {
6 var chunks = []; 6 var chunks = [];
7 function rec(reader) { 7 function rec(reader) {
8 return reader.read().then(function(r) { 8 return reader.read().then(function(r) {
9 if (r.done) { 9 if (r.done) {
10 return chunks; 10 return chunks;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 promise_test(function(t) { 301 promise_test(function(t) {
302 var res = new Response(new Blob([''])); 302 var res = new Response(new Blob(['']));
303 return res.blob() 303 return res.blob()
304 .then(function(blob) { 304 .then(function(blob) {
305 assert_equals(blob.type, ''); 305 assert_equals(blob.type, '');
306 assert_equals(res.headers.get('Content-Type'), null); 306 assert_equals(res.headers.get('Content-Type'), null);
307 }); 307 });
308 }, 'MIME type for Blob'); 308 }, 'MIME type for Blob');
309 309
310 promise_test(function(t) { 310 promise_test(function(t) {
311 var res = new Response(new Blob([''], {type: 'Text/Plain'})); 311 var res = new Response(new Blob(['hello'], {type: 'Text/Plain'}));
312 return res.blob() 312 return res.blob()
313 .then(function(blob) { 313 .then(function(blob) {
314 assert_equals(blob.type, 'text/plain'); 314 assert_equals(blob.type, 'text/plain');
315 assert_equals(blob.size, 5);
316 assert_equals(res.headers.get('Content-Type'), 'text/plain');
317 return res.blob();
318 }).then(function(blob) {
hiroshige 2015/04/21 07:17:13 Please add a comment that states what we are testi
yhirano 2015/04/22 02:35:30 Done.
319 assert_equals(blob.type, 'text/plain');
320 assert_equals(blob.size, 0);
315 assert_equals(res.headers.get('Content-Type'), 'text/plain'); 321 assert_equals(res.headers.get('Content-Type'), 'text/plain');
316 }); 322 });
317 }, 'MIME type for Blob with non-empty type'); 323 }, 'MIME type for Blob with non-empty type');
318 324
319 promise_test(function(t) { 325 promise_test(function(t) {
320 var res = new Response(new FormData()); 326 var res = new Response(new FormData());
321 return res.blob() 327 return res.blob()
322 .then(function(blob) { 328 .then(function(blob) {
323 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), 329 assert_equals(blob.type.indexOf('multipart/form-data; boundary='),
324 0); 330 0);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 assert_equals(texts[0], ''); 425 assert_equals(texts[0], '');
420 assert_equals(texts[1], ''); 426 assert_equals(texts[1], '');
421 return res.body.getReader().read(); 427 return res.body.getReader().read();
422 }).then(function(r) { 428 }).then(function(r) {
423 assert_true(r.done); 429 assert_true(r.done);
424 assert_equals(r.value, undefined); 430 assert_equals(r.value, undefined);
425 }); 431 });
426 }, 'Read after text()'); 432 }, 'Read after text()');
427 433
428 done(); 434 done();
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/request.js ('k') | Source/modules/fetch/Body.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698