| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 }, 'MIME type for Blob'); | 518 }, 'MIME type for Blob'); |
| 519 | 519 |
| 520 promise_test(function(t) { | 520 promise_test(function(t) { |
| 521 var req = new Request('http://localhost/', | 521 var req = new Request('http://localhost/', |
| 522 {method: 'POST', | 522 {method: 'POST', |
| 523 body: new Blob([''], {type: 'Text/Plain'})}); | 523 body: new Blob([''], {type: 'Text/Plain'})}); |
| 524 return req.blob() | 524 return req.blob() |
| 525 .then(function(blob) { | 525 .then(function(blob) { |
| 526 assert_equals(blob.type, 'text/plain'); | 526 assert_equals(blob.type, 'text/plain'); |
| 527 assert_equals(req.headers.get('Content-Type'), 'text/plain'); | 527 assert_equals(req.headers.get('Content-Type'), 'text/plain'); |
| 528 // TODO(yhirano): Currently blob() calling sets |bodyUsed| parmanently. Fix it. | 528 return new Request(req).blob(); |
| 529 // return new Request(req).blob(); | 529 }).then(function(blob) { |
| 530 // }).then(function(blob) { | 530 assert_equals(blob.type, 'text/plain'); |
| 531 // assert_equals(blob.type, 'text/plain'); | |
| 532 }); | 531 }); |
| 533 }, 'MIME type for Blob with non-empty type'); | 532 }, 'MIME type for Blob with non-empty type'); |
| 534 | 533 |
| 535 promise_test(function(t) { | 534 promise_test(function(t) { |
| 536 var req = new Request('http://localhost/', | 535 var req = new Request('http://localhost/', |
| 537 {method: 'POST', body: new FormData()}); | 536 {method: 'POST', body: new FormData()}); |
| 538 return req.blob() | 537 return req.blob() |
| 539 .then(function(blob) { | 538 .then(function(blob) { |
| 540 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), | 539 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), |
| 541 0); | 540 0); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 610 |
| 612 // Tests for requests context. | 611 // Tests for requests context. |
| 613 test(function() { | 612 test(function() { |
| 614 var request = new Request('http://localhost/', {method: 'POST', body: ''}); | 613 var request = new Request('http://localhost/', {method: 'POST', body: ''}); |
| 615 assert_equals(request.context, '', | 614 assert_equals(request.context, '', |
| 616 'Request.context should be empty string ' + | 615 'Request.context should be empty string ' + |
| 617 'for synthetic Request object'); | 616 'for synthetic Request object'); |
| 618 }, 'RequestContext of a synthetic Request object'); | 617 }, 'RequestContext of a synthetic Request object'); |
| 619 | 618 |
| 620 done(); | 619 done(); |
| OLD | NEW |