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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 assert_throws( | 636 assert_throws( |
637 {name: 'TypeError'}, | 637 {name: 'TypeError'}, |
638 function() { | 638 function() { |
639 new Request('http://localhost/', | 639 new Request('http://localhost/', |
640 {headers: [['X-Fetch-Test', value]]}); | 640 {headers: [['X-Fetch-Test', value]]}); |
641 }, | 641 }, |
642 'new Request with headers with an invalid value should throw'); | 642 'new Request with headers with an invalid value should throw'); |
643 }); | 643 }); |
644 }, 'Request throw error test'); | 644 }, 'Request throw error test'); |
645 | 645 |
646 test(function() { | |
647 var req = new Request(URL, {method: 'GET'}); | |
648 assert_equals(req.referrer, 'about:client', | |
649 'Request.referrer should be client'); | |
650 }, 'Request referrer test, if inits members are present'); | |
hiroshige
2015/11/19 11:17:41
This seems already tested?
https://code.google.com
| |
651 | |
646 // Tests for MIME types. | 652 // Tests for MIME types. |
647 promise_test(function(t) { | 653 promise_test(function(t) { |
648 var req = new Request('http://localhost/', | 654 var req = new Request('http://localhost/', |
649 {method: 'POST', body: new Blob([''])}); | 655 {method: 'POST', body: new Blob([''])}); |
650 return req.blob() | 656 return req.blob() |
651 .then(function(blob) { | 657 .then(function(blob) { |
652 assert_equals(blob.type, ''); | 658 assert_equals(blob.type, ''); |
653 assert_equals(req.headers.get('Content-Type'), null); | 659 assert_equals(req.headers.get('Content-Type'), null); |
654 }); | 660 }); |
655 }, 'MIME type for Blob'); | 661 }, 'MIME type for Blob'); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 var req2 = new Request(req); | 745 var req2 = new Request(req); |
740 assert_true(req.bodyUsed); | 746 assert_true(req.bodyUsed); |
741 assert_false(req2.bodyUsed); | 747 assert_false(req2.bodyUsed); |
742 return req2.text(); | 748 return req2.text(); |
743 }).then(function(text) { | 749 }).then(function(text) { |
744 assert_equals(text, ''); | 750 assert_equals(text, ''); |
745 }); | 751 }); |
746 }, 'Consume and pass'); | 752 }, 'Consume and pass'); |
747 | 753 |
748 done(); | 754 done(); |
OLD | NEW |