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 importScripts('/streams/resources/rs-utils.js'); | 3 importScripts('/streams/resources/rs-utils.js'); |
4 } | 4 } |
5 | 5 |
6 function decode(chunks) { | 6 function decode(chunks) { |
7 var decoder = new TextDecoder(); | 7 var decoder = new TextDecoder(); |
8 var result = ''; | 8 var result = ''; |
9 for (var chunk of chunks) { | 9 for (var chunk of chunks) { |
10 result += decoder.decode(chunk, {stream: true}); | 10 result += decoder.decode(chunk, {stream: true}); |
11 } | 11 } |
12 result += decoder.decode(new Uint8Array(0)); | 12 result += decoder.decode(new Uint8Array(0)); |
13 return result; | 13 return result; |
14 } | 14 } |
15 | 15 |
16 test(function() { | 16 test(function() { |
17 var response = new Response(); | 17 var response = new Response(); |
18 assert_equals(response.type, 'default', | 18 assert_equals(response.type, 'default', |
19 'Default Response.type should be \'default\''); | 19 'Default Response.type should be \'default\''); |
20 assert_equals(response.url, '', 'Response.url should be the empty string'); | 20 assert_equals(response.url, '', 'Response.url should be the empty string'); |
| 21 assert_false(response.redirected, 'Response.redirected should be false.'); |
21 assert_equals(response.status, 200, | 22 assert_equals(response.status, 200, |
22 'Default Response.status should be 200'); | 23 'Default Response.status should be 200'); |
23 assert_true(response.ok, 'Default Response.ok must be true'); | 24 assert_true(response.ok, 'Default Response.ok must be true'); |
24 assert_equals(response.statusText, 'OK', | 25 assert_equals(response.statusText, 'OK', |
25 'Default Response.statusText should be \'OK\''); | 26 'Default Response.statusText should be \'OK\''); |
26 assert_equals(size(response.headers), 0, | 27 assert_equals(size(response.headers), 0, |
27 'Default Response should not have any header.'); | 28 'Default Response should not have any header.'); |
28 if (self.internals) { | 29 if (self.internals) { |
29 var urlList = self.internals.getInternalResponseURLList(response); | 30 var urlList = self.internals.getInternalResponseURLList(response); |
30 assert_equals(urlList.length, 0, | 31 assert_equals(urlList.length, 0, |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 test(function() { | 460 test(function() { |
460 ['http://ex\x0aample.com', | 461 ['http://ex\x0aample.com', |
461 'http://ex\x0dample.com'].forEach(function(url) { | 462 'http://ex\x0dample.com'].forEach(function(url) { |
462 assert_equals(Response.redirect(url).headers.get('Location'), | 463 assert_equals(Response.redirect(url).headers.get('Location'), |
463 'http://example.com/', | 464 'http://example.com/', |
464 'Location header value must not contain CR or LF'); | 465 'Location header value must not contain CR or LF'); |
465 }); | 466 }); |
466 }, 'Response.redirect() with URLs with CR or LF'); | 467 }, 'Response.redirect() with URLs with CR or LF'); |
467 | 468 |
468 done(); | 469 done(); |
OLD | NEW |