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

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

Issue 1098473003: Implement redirect() API for Fetch Response (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
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 // Tests that invalid names/values throw TypeError. 5 // Tests that invalid names/values throw TypeError.
6 function testInvalidNamesAndValues(headers) { 6 function testInvalidNamesAndValues(headers) {
7 INVALID_HEADER_NAMES.forEach(function(name) { 7 INVALID_HEADER_NAMES.forEach(function(name) {
8 assert_throws({name: 'TypeError'}, 8 assert_throws({name: 'TypeError'},
9 function() { headers.append(name, 'a'); }, 9 function() { headers.append(name, 'a'); },
10 'Headers.append with an invalid name (' + name + 10 'Headers.append with an invalid name (' + name +
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 header + ' must be set (2)'); 361 header + ' must be set (2)');
362 }); 362 });
363 }, 'Headers guard = response: ResponseInit.headers'); 363 }, 'Headers guard = response: ResponseInit.headers');
364 364
365 promise_test(function(t) { 365 promise_test(function(t) {
366 return fetch('../resources/doctype.html') 366 return fetch('../resources/doctype.html')
367 .then(function(res) { 367 .then(function(res) {
368 [res.headers, 368 [res.headers,
369 res.clone().headers, 369 res.clone().headers,
370 Response.error().headers, 370 Response.error().headers,
371 Response.error().clone().headers].forEach(function(headers) { 371 Response.error().clone().headers,
372 Response.redirect().headers,
yhirano 2015/04/20 04:55:30 Response.redirect throws when |url| is not provide
shiva.jm 2015/04/27 10:50:54 Done. added valid URL to correct tests.
373 Response.redirect().clone().headers].forEach(function(headers) {
372 testInvalidNamesAndValues(headers); 374 testInvalidNamesAndValues(headers);
373 375
374 // Test that TypeError is thrown for all header names. 376 // Test that TypeError is thrown for all header names.
375 FORBIDDEN_HEADER_NAMES 377 FORBIDDEN_HEADER_NAMES
376 .concat(FORBIDDEN_RESPONSE_HEADER_NAMES) 378 .concat(FORBIDDEN_RESPONSE_HEADER_NAMES)
377 .concat(SIMPLE_HEADER_NAMES) 379 .concat(SIMPLE_HEADER_NAMES)
378 .concat([CONTENT_TYPE]) 380 .concat([CONTENT_TYPE])
379 .concat(NON_SIMPLE_HEADER_NAMES) 381 .concat(NON_SIMPLE_HEADER_NAMES)
380 .forEach(function(header) { 382 .forEach(function(header) {
381 var value = headers.get(header); 383 var value = headers.get(header);
(...skipping 14 matching lines...) Expand all
396 function() { headers.delete(header); }, 398 function() { headers.delete(header); },
397 'Headers.delete(' + header + ') must throw'); 399 'Headers.delete(' + header + ') must throw');
398 assert_equals(headers.get(header), value, 400 assert_equals(headers.get(header), value,
399 'header ' + header + ' must be unchanged by delete()'); 401 'header ' + header + ' must be unchanged by delete()');
400 }); 402 });
401 }); 403 });
402 }); 404 });
403 }, 'Headers guard = immutable: set/append/delete'); 405 }, 'Headers guard = immutable: set/append/delete');
404 406
405 done(); 407 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698