Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 || 'follow', | |
|
yhirano
2015/05/25 06:30:52
What does this "redirect1 || 'follow'" mean?
shiva.jm
2015/05/25 12:01:57
Done.
| |
| 628 'Request.redirect should match'); | |
| 629 request1 = new Request(request1); | |
| 630 assert_equals(request1.redirect, redirect1 || 'follow', | |
|
yhirano
2015/05/25 06:30:52
ditto
shiva.jm
2015/05/25 12:01:56
Done.
| |
| 631 'Request.redirect should match'); | |
| 632 }); | |
| 633 }, 'Request redirect mode test'); | |
| 634 | |
| 635 test(function() { | |
| 636 assert_throws( | |
| 637 {name: 'TypeError'}, | |
| 638 function() { | |
| 639 new Request('http://localhost/',{method: 'POST', redirect: 'manual'}); | |
| 640 }, | |
| 641 'new Request with manual redirect mode should throw'); | |
| 642 | |
| 643 }, 'Request redirect with manual mode test'); | |
| 619 done(); | 644 done(); |
| OLD | NEW |