OLD | NEW |
1 <script src="../../resources/testharness.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
2 <script src="../../resources/get-host-info.js?pipe=sub"></script> | 2 <script src="../../resources/get-host-info.js?pipe=sub"></script> |
3 <script src="test-helpers.js"></script> | 3 <script src="test-helpers.js"></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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 header_names.sort(); | 63 header_names.sort(); |
64 return header_names; | 64 return header_names; |
65 } | 65 } |
66 | 66 |
67 function get_header_test() { | 67 function get_header_test() { |
68 return xhr_send(host_info['HTTP_ORIGIN'], 'GET', '', false) | 68 return xhr_send(host_info['HTTP_ORIGIN'], 'GET', '', false) |
69 .then(function(response) { | 69 .then(function(response) { |
70 assert_array_equals( | 70 assert_array_equals( |
71 get_sorted_header_name_list(response.headers), | 71 get_sorted_header_name_list(response.headers), |
72 ["accept", "user-agent"], | 72 ["accept", "origin", "user-agent"], |
73 'event.request has the expected headers for same-origin GET.'); | 73 'event.request has the expected headers for same-origin GET.'); |
74 }); | 74 }); |
75 } | 75 } |
76 | 76 |
77 // TODO(tyoshino): Fix the stack not to include the Origin header as specified | 77 // TODO(tyoshino): Fix the stack not to include the Origin header as specified |
78 // in the spec. | 78 // in the spec. |
79 function post_header_test() { | 79 function post_header_test() { |
80 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', '', false) | 80 return xhr_send(host_info['HTTP_ORIGIN'], 'POST', '', false) |
81 .then(function(response) { | 81 .then(function(response) { |
82 assert_array_equals( | 82 assert_array_equals( |
83 get_sorted_header_name_list(response.headers), | 83 get_sorted_header_name_list(response.headers), |
84 ["accept", "content-type", "origin", "user-agent"], | 84 ["accept", "content-type", "origin", "user-agent"], |
85 'event.request has the expected headers for same-origin POST.'); | 85 'event.request has the expected headers for same-origin POST.'); |
86 }); | 86 }); |
87 } | 87 } |
88 | 88 |
89 function cross_origin_get_header_test() { | 89 function cross_origin_get_header_test() { |
90 return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'GET', '', false) | 90 return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'GET', '', false) |
91 .then(function(response) { | 91 .then(function(response) { |
92 assert_array_equals( | 92 assert_array_equals( |
93 get_sorted_header_name_list(response.headers), | 93 get_sorted_header_name_list(response.headers), |
94 ["accept", "user-agent"], | 94 ["accept", "origin", "user-agent"], |
95 'event.request has the expected headers for cross-origin GET.'); | 95 'event.request has the expected headers for cross-origin GET.'); |
96 }); | 96 }); |
97 } | 97 } |
98 | 98 |
99 // TODO(tyoshino): Fix the stack not to include the Origin header as specified | 99 // TODO(tyoshino): Fix the stack not to include the Origin header as specified |
100 // in the spec. | 100 // in the spec. |
101 function cross_origin_post_header_test() { | 101 function cross_origin_post_header_test() { |
102 return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'POST', '', false) | 102 return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'POST', '', false) |
103 .then(function(response) { | 103 .then(function(response) { |
104 assert_array_equals( | 104 assert_array_equals( |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 .then(blob_test) | 233 .then(blob_test) |
234 .then(custom_method_test) | 234 .then(custom_method_test) |
235 .then(options_method_test) | 235 .then(options_method_test) |
236 .then(form_data_test) | 236 .then(form_data_test) |
237 .then(mode_credentials_test) | 237 .then(mode_credentials_test) |
238 .then(data_url_test) | 238 .then(data_url_test) |
239 .then(function() { port.postMessage({results: 'finish'}); }) | 239 .then(function() { port.postMessage({results: 'finish'}); }) |
240 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); | 240 .catch(function(e) { port.postMessage({results: 'failure:' + e}); }); |
241 }); | 241 }); |
242 </script> | 242 </script> |
OLD | NEW |