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

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

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 } 3 }
4 4
5 promise_test(function(t) { 5 promise_test(function(t) {
6 return fetch('http://') 6 return fetch('http://')
7 .then( 7 .then(
8 t.unreached_func('fetch of invalid URL must fail'), 8 t.unreached_func('fetch of invalid URL must fail'),
9 function() {}); 9 function() {});
10 }, 'Fetch invalid URL'); 10 }, 'Fetch invalid URL');
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 test(function(t) { 349 test(function(t) {
350 function runInfiniteFetchLoop() { 350 function runInfiniteFetchLoop() {
351 fetch('dummy.html') 351 fetch('dummy.html')
352 .then(function() { runInfiniteFetchLoop(); }); 352 .then(function() { runInfiniteFetchLoop(); });
353 } 353 }
354 runInfiniteFetchLoop(); 354 runInfiniteFetchLoop();
355 }, 355 },
356 'Destroying the execution context while fetch is happening should not ' + 356 'Destroying the execution context while fetch is happening should not ' +
357 'cause a crash.'); 357 'cause a crash.');
358 358
359 test(t => {
360 var req = new Request('/', {method: 'POST', body: ''});
361 fetch(req);
362 assert_true(req.bodyUsed);
363 }, 'Calling fetch() disturbs body if not null');
364
365 test(t => {
366 var req = new Request('/', {method: 'POST'});
367 fetch(req);
368 assert_false(req.bodyUsed);
369 }, 'Calling fetch() doesn\'t disturb body if null');
370
359 done(); 371 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698