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

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

Issue 1053503002: [Fetch] Response.clone should tee the body stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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 | « no previous file | LayoutTests/http/tests/fetch/script-tests/response.js » ('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 var URL = 'https://www.example.com/test.html'; 5 var URL = 'https://www.example.com/test.html';
6 6
7 function size(headers) { 7 function size(headers) {
8 var count = 0; 8 var count = 0;
9 for (var header of headers) { 9 for (var header of headers) {
10 ++count; 10 ++count;
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 assert_equals(req.headers.get('Content-Type'), 661 assert_equals(req.headers.get('Content-Type'),
662 'text/plain;charset=UTF-8'); 662 'text/plain;charset=UTF-8');
663 }); 663 });
664 }, 'MIME type for USVString'); 664 }, 'MIME type for USVString');
665 665
666 promise_test(function(t) { 666 promise_test(function(t) {
667 var req = new Request('http://localhost/', 667 var req = new Request('http://localhost/',
668 {method: 'POST', 668 {method: 'POST',
669 body: new Blob([''], {type: 'Text/Plain'}), 669 body: new Blob([''], {type: 'Text/Plain'}),
670 headers: [['Content-Type', 'Text/Html']]}); 670 headers: [['Content-Type', 'Text/Html']]});
671 req = req.clone(); 671 var clone = req.clone();
672 return req.blob() 672 return Promise.all([req.blob(), clone.blob()])
673 .then(function(blob) { 673 .then(function(blobs) {
674 assert_equals(blob.type, 'text/html'); 674 assert_equals(blobs[0].type, 'text/html');
675 assert_equals(blobs[1].type, 'text/html');
675 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); 676 assert_equals(req.headers.get('Content-Type'), 'Text/Html');
677 assert_equals(clone.headers.get('Content-Type'), 'Text/Html');
676 }); 678 });
677 }, 'Extract a MIME type with clone'); 679 }, 'Extract a MIME type with clone');
678 680
679 promise_test(function(t) { 681 promise_test(function(t) {
680 var req = new Request('http://localhost/', 682 var req = new Request('http://localhost/',
681 {method: 'POST', 683 {method: 'POST',
682 body: new Blob([''], {type: 'Text/Plain'})}); 684 body: new Blob([''], {type: 'Text/Plain'})});
683 req.headers.set('Content-Type', 'Text/Html'); 685 req.headers.set('Content-Type', 'Text/Html');
684 return req.blob() 686 return req.blob()
685 .then(function(blob) { 687 .then(function(blob) {
686 assert_equals(blob.type, 'text/plain'); 688 assert_equals(blob.type, 'text/plain');
687 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); 689 assert_equals(req.headers.get('Content-Type'), 'Text/Html');
688 }); 690 });
689 }, 691 },
690 'MIME type unchanged if headers are modified after Request() constructor'); 692 'MIME type unchanged if headers are modified after Request() constructor');
691 693
692 promise_test(function(t) { 694 promise_test(function(t) {
693 var req = new Request('http://localhost/', 695 var req = new Request('http://localhost/',
694 {method: 'POST', 696 {method: 'POST',
695 body: new Blob([''], {type: 'Text/Plain'}), 697 body: new Blob([''], {type: 'Text/Plain'}),
696 headers: [['Content-Type', 'Text/Html']]}); 698 headers: [['Content-Type', 'Text/Html']]});
697 return req.blob() 699 return req.blob()
698 .then(function(blob) { 700 .then(function(blob) {
699 assert_equals(blob.type, 'text/html'); 701 assert_equals(blob.type, 'text/html');
700 assert_equals(req.headers.get('Content-Type'), 'Text/Html'); 702 assert_equals(req.headers.get('Content-Type'), 'Text/Html');
701 }); 703 });
702 }, 'Extract a MIME type (1)'); 704 }, 'Extract a MIME type (1)');
703 705
704 done(); 706 done();
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/fetch/script-tests/response.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698