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

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

Issue 1920703002: [Fetch API] Fix leaky layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('../resources/fetch-test-helpers.js'); 2 importScripts('../resources/fetch-test-helpers.js');
3 importScripts('/streams/resources/rs-utils.js'); 3 importScripts('/streams/resources/rs-utils.js');
4 } 4 }
5 5
6 function decode(chunks) { 6 function decode(chunks) {
7 var decoder = new TextDecoder(); 7 var decoder = new TextDecoder();
8 var result = ''; 8 var result = '';
9 for (var chunk of chunks) { 9 for (var chunk of chunks) {
10 result += decoder.decode(chunk, {stream: true}); 10 result += decoder.decode(chunk, {stream: true});
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 test(() => { 312 test(() => {
313 var res = new Response('hello'); 313 var res = new Response('hello');
314 res.body.cancel(); 314 res.body.cancel();
315 assert_true(res.bodyUsed); 315 assert_true(res.bodyUsed);
316 assert_throws({name: 'TypeError'}, () => res.clone()); 316 assert_throws({name: 'TypeError'}, () => res.clone());
317 }, 'Used => clone'); 317 }, 'Used => clone');
318 318
319 test(() => { 319 test(() => {
320 var res = new Response('hello'); 320 var res = new Response('hello');
321 res.body.getReader(); 321 const reader = res.body.getReader();
322 assert_false(res.bodyUsed); 322 assert_false(res.bodyUsed);
323 assert_throws({name: 'TypeError'}, () => res.clone()); 323 assert_throws({name: 'TypeError'}, () => res.clone());
324 reader.releaseLock();
324 }, 'Locked => clone'); 325 }, 'Locked => clone');
325 326
326 // Tests for MIME types. 327 // Tests for MIME types.
327 promise_test(function(t) { 328 promise_test(function(t) {
328 var res = new Response(new Blob([''])); 329 var res = new Response(new Blob(['']));
329 return res.blob() 330 return res.blob()
330 .then(function(blob) { 331 .then(function(blob) {
331 assert_equals(blob.type, ''); 332 assert_equals(blob.type, '');
332 assert_equals(res.headers.get('Content-Type'), null); 333 assert_equals(res.headers.get('Content-Type'), null);
333 }); 334 });
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 test(function() { 449 test(function() {
449 ['http://ex\x0aample.com', 450 ['http://ex\x0aample.com',
450 'http://ex\x0dample.com'].forEach(function(url) { 451 'http://ex\x0dample.com'].forEach(function(url) {
451 assert_equals(Response.redirect(url).headers.get('Location'), 452 assert_equals(Response.redirect(url).headers.get('Location'),
452 'http://example.com/', 453 'http://example.com/',
453 'Location header value must not contain CR or LF'); 454 'Location header value must not contain CR or LF');
454 }); 455 });
455 }, 'Response.redirect() with URLs with CR or LF'); 456 }, 'Response.redirect() with URLs with CR or LF');
456 457
457 done(); 458 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698