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

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

Issue 1143083002: Implement request's redirect mode and RequestRedirect for Fetch (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
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 test(function() { 7 test(function() {
8 var headers = new Headers; 8 var headers = new Headers;
9 headers.set('User-Agent', 'Mozilla/5.0'); 9 headers.set('User-Agent', 'Mozilla/5.0');
10 headers.set('Accept', 'text/html'); 10 headers.set('Accept', 'text/html');
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 }, 'Consume and pass'); 609 }, 'Consume and pass');
610 610
611 // Tests for requests context. 611 // Tests for requests context.
612 test(function() { 612 test(function() {
613 var request = new Request('http://localhost/', {method: 'POST', body: ''}); 613 var request = new Request('http://localhost/', {method: 'POST', body: ''});
614 assert_equals(request.context, '', 614 assert_equals(request.context, '',
615 'Request.context should be empty string ' + 615 'Request.context should be empty string ' +
616 'for synthetic Request object'); 616 'for synthetic Request object');
617 }, 'RequestContext of a synthetic Request object'); 617 }, 'RequestContext of a synthetic Request object');
618 618
619 // Tests for requests redirect mode.
620 test(function() {
621 var request1 = {};
622 var REDIRECT = ['follow', 'error'];
623 REDIRECT.forEach(function(redirect1) {
624 var init1 = {};
625 init1['redirect'] = redirect1;
626 request1 = new Request(URL, init1);
627 assert_equals(request1.redirect, redirect1,
628 'Request.redirect with redirect mode ' + redirect1 +
629 ' should match');
630 request1 = new Request(request1);
631 assert_equals(request1.redirect, redirect1,
632 'Request.redirect with redirect mode ' + redirect1 +
633 ' should match');
634
635 });
636 }, 'Request redirect mode test');
637
638 test(function() {
639 assert_throws(
640 {name: 'TypeError'},
641 function() {
642 new Request('http://localhost/',{method: 'POST', redirect: 'manual'});
643 },
644 'new Request with manual redirect mode should throw');
645
646 }, 'Request redirect with manual mode test');
619 done(); 647 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698