OLD | NEW |
1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
2 <script src="../../resources/get-host-info.js"></script> | 2 <script src="../../resources/get-host-info.js"></script> |
3 <script src="test-helpers.js?pipe=sub"></script> | 3 <script src="test-helpers.js?pipe=sub"></script> |
4 <script> | 4 <script> |
5 var host_info = get_host_info(); | 5 var host_info = get_host_info(); |
6 | 6 |
7 function get_boundary(headers) { | 7 function get_boundary(headers) { |
8 var reg = new RegExp('multipart\/form-data; boundary=(.*)'); | 8 var reg = new RegExp('multipart\/form-data; boundary=(.*)'); |
9 for (var i = 0; i < headers.length; ++i) { | 9 for (var i = 0; i < headers.length; ++i) { |
10 if (headers[i][0] != 'content-type') { | 10 if (headers[i][0] != 'content-type') { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 xhr.open(method, url_base + '/dummy?test', true); | 53 xhr.open(method, url_base + '/dummy?test', true); |
54 xhr.send(data); | 54 xhr.send(data); |
55 }); | 55 }); |
56 } | 56 } |
57 | 57 |
58 function string_test() { | 58 function string_test() { |
59 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', 'test string', false) | 59 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', 'test string', false) |
60 .then(function(response) { | 60 .then(function(response) { |
61 assert_equals(response.context, 'xmlhttprequest'); | 61 assert_equals(response.context, 'xmlhttprequest'); |
| 62 assert_equals(response.redirect, 'follow'); |
62 assert_equals(response.method, 'POST'); | 63 assert_equals(response.method, 'POST'); |
63 assert_equals(response.body, 'test string'); | 64 assert_equals(response.body, 'test string'); |
64 }); | 65 }); |
65 } | 66 } |
66 | 67 |
67 function blob_test() { | 68 function blob_test() { |
68 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', new Blob(['test blob']), | 69 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', new Blob(['test blob']), |
69 false) | 70 false) |
70 .then(function(response) { | 71 .then(function(response) { |
71 assert_equals(response.context, 'xmlhttprequest'); | 72 assert_equals(response.context, 'xmlhttprequest'); |
| 73 assert_equals(response.redirect, 'follow'); |
72 assert_equals(response.method, 'POST'); | 74 assert_equals(response.method, 'POST'); |
73 assert_equals(response.body, 'test blob'); | 75 assert_equals(response.body, 'test blob'); |
74 }); | 76 }); |
75 } | 77 } |
76 | 78 |
77 function custom_method_test() { | 79 function custom_method_test() { |
78 return xhr_send(host_info['HTTP_ORIGIN'], 'XXX', 'test string xxx', false) | 80 return xhr_send(host_info['HTTP_ORIGIN'], 'XXX', 'test string xxx', false) |
79 .then(function(response) { | 81 .then(function(response) { |
80 assert_equals(response.method, 'XXX'); | 82 assert_equals(response.method, 'XXX'); |
81 assert_equals(response.body, 'test string xxx'); | 83 assert_equals(response.body, 'test string xxx'); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 .then(blob_test) | 180 .then(blob_test) |
179 .then(custom_method_test) | 181 .then(custom_method_test) |
180 .then(options_method_test) | 182 .then(options_method_test) |
181 .then(form_data_test) | 183 .then(form_data_test) |
182 .then(mode_credentials_test) | 184 .then(mode_credentials_test) |
183 .then(data_url_test) | 185 .then(data_url_test) |
184 .then(function() { port.postMessage({results: 'finish'}); }) | 186 .then(function() { port.postMessage({results: 'finish'}); }) |
185 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); | 187 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); |
186 }); | 188 }); |
187 </script> | 189 </script> |
OLD | NEW |