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

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

Issue 1109423005: Revive a fetch() test accidentally removed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 promise_test(function(t) { 339 promise_test(function(t) {
340 var res = new Response(new Blob([''])); 340 var res = new Response(new Blob(['']));
341 return res.blob() 341 return res.blob()
342 .then(function(blob) { 342 .then(function(blob) {
343 assert_equals(blob.type, ''); 343 assert_equals(blob.type, '');
344 assert_equals(res.headers.get('Content-Type'), null); 344 assert_equals(res.headers.get('Content-Type'), null);
345 }); 345 });
346 }, 'MIME type for Blob'); 346 }, 'MIME type for Blob');
347 347
348 promise_test(function(t) { 348 promise_test(function(t) {
349 var res = new Response(new Blob([''], {type: 'Text/Plain'})); 349 var res = new Response(new Blob(['hello'], {type: 'Text/Plain'}));
350 return res.blob() 350 return res.blob()
351 .then(function(blob) { 351 .then(function(blob) {
352 assert_equals(blob.type, 'text/plain'); 352 assert_equals(blob.type, 'text/plain');
353 assert_equals(blob.size, 5);
354 assert_equals(res.headers.get('Content-Type'), 'text/plain');
355 return res.blob();
356 }).then(function(blob) {
357 // When we read from a response twice, it returns an empty contents.
358 // But the type should remain.
359 assert_equals(blob.type, 'text/plain');
360 assert_equals(blob.size, 0);
353 assert_equals(res.headers.get('Content-Type'), 'text/plain'); 361 assert_equals(res.headers.get('Content-Type'), 'text/plain');
354 }); 362 });
355 }, 'MIME type for Blob with non-empty type'); 363 }, 'MIME type for Blob with non-empty type');
356 364
357 promise_test(function(t) { 365 promise_test(function(t) {
358 var res = new Response(new FormData()); 366 var res = new Response(new FormData());
359 return res.blob() 367 return res.blob()
360 .then(function(blob) { 368 .then(function(blob) {
361 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), 369 assert_equals(blob.type.indexOf('multipart/form-data; boundary='),
362 0); 370 0);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 test(function() { 505 test(function() {
498 ['http://ex\x0aample.com', 506 ['http://ex\x0aample.com',
499 'http://ex\x0dample.com'].forEach(function(url) { 507 'http://ex\x0dample.com'].forEach(function(url) {
500 assert_equals(Response.redirect(url).headers.get('Location'), 508 assert_equals(Response.redirect(url).headers.get('Location'),
501 'http://example.com/', 509 'http://example.com/',
502 'Location header value must not contain CR or LF'); 510 'Location header value must not contain CR or LF');
503 }); 511 });
504 }, 'Response.redirect() with URLs with CR or LF'); 512 }, 'Response.redirect() with URLs with CR or LF');
505 513
506 done(); 514 done();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698