| OLD | NEW |
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
| 3 importScripts('/resources/testharness-helpers.js'); |
| 3 importScripts('/serviceworker/resources/test-helpers.js'); | 4 importScripts('/serviceworker/resources/test-helpers.js'); |
| 4 importScripts('../resources/fetch-test-options.js'); | 5 importScripts('../resources/fetch-test-options.js'); |
| 5 } | 6 } |
| 6 | 7 |
| 7 function getContentType(headers) { | 8 function getContentType(headers) { |
| 8 var content_type = ''; | 9 var content_type = ''; |
| 9 for (var header of headers) { | 10 for (var header of headers) { |
| 10 if (header[0] == 'content-type') | 11 if (header[0] == 'content-type') |
| 11 content_type = header[1]; | 12 content_type = header[1]; |
| 12 } | 13 } |
| 13 return content_type; | 14 return content_type; |
| 14 } | 15 } |
| 15 | 16 |
| 16 | |
| 17 (function () { | |
| 18 var sequential_promise = Promise.resolve(); | |
| 19 | |
| 20 // |sequential_test| is a dummy test to prevent tests from terminating early. | |
| 21 // Without this, the number of pending tests recognized by testharness can | |
| 22 // be zero, which leads to early unexpected test termination. | |
| 23 var sequential_test = undefined; | |
| 24 | |
| 25 // sequential_promise_test() is similar to promise_test(), but multiple tests | |
| 26 // are executed one by one sequentially. | |
| 27 // Also call sequential_promise_test_done() after all | |
| 28 // sequential_promise_test() are called. | |
| 29 function sequential_promise_test(func, name) { | |
| 30 if (sequential_test === undefined) { | |
| 31 sequential_test = async_test('Sequential'); | |
| 32 } | |
| 33 sequential_promise = sequential_promise | |
| 34 .then(function() { | |
| 35 var promise = undefined; | |
| 36 promise_test(function(t) { | |
| 37 promise = func(t); | |
| 38 return promise; | |
| 39 }, name); | |
| 40 return promise; | |
| 41 }) | |
| 42 .catch(function(e) { | |
| 43 // The error was already reported. Continue to the next test. | |
| 44 }); | |
| 45 } | |
| 46 | |
| 47 function sequential_promise_test_done() { | |
| 48 if (sequential_test !== undefined) { | |
| 49 sequential_promise.then(function() {sequential_test.done();}); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 self.sequential_promise_test = sequential_promise_test; | |
| 54 self.sequential_promise_test_done = sequential_promise_test_done; | |
| 55 })(); | |
| 56 | |
| 57 // token [RFC 2616] | 17 // token [RFC 2616] |
| 58 // "token = 1*<any CHAR except CTLs or separators>" | 18 // "token = 1*<any CHAR except CTLs or separators>" |
| 59 // All octets are tested except for those >= 0x80. | 19 // All octets are tested except for those >= 0x80. |
| 60 var INVALID_TOKENS = [ | 20 var INVALID_TOKENS = [ |
| 61 '', | 21 '', |
| 62 // CTL | 22 // CTL |
| 63 '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', | 23 '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', |
| 64 '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', | 24 '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', |
| 65 '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', | 25 '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', |
| 66 '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '\x7f', | 26 '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '\x7f', |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 function() { | 209 function() { |
| 250 if (mode !== 'same-origin') { | 210 if (mode !== 'same-origin') { |
| 251 assert_unreached( | 211 assert_unreached( |
| 252 'Test 5: Cross-origin HTTPS request must success: ' + | 212 'Test 5: Cross-origin HTTPS request must success: ' + |
| 253 'mode = ' + mode); | 213 'mode = ' + mode); |
| 254 } | 214 } |
| 255 }); | 215 }); |
| 256 }); | 216 }); |
| 257 }, 'Block fetch() as mixed content (' + mode + ')'); | 217 }, 'Block fetch() as mixed content (' + mode + ')'); |
| 258 } | 218 } |
| OLD | NEW |