Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html |
| index b485ee2e7a6736b6ab361a1c8c08594f83fc4a5f..60e7b8353355d16a7d2d1e25677bedc1429f57d7 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html |
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-request-xhr-iframe.html |
| @@ -55,6 +55,59 @@ function xhr_send(url_base, method, data, with_credentials) { |
| }); |
| } |
| +function get_sorted_header_name_list(headers) { |
|
yhirano
2016/07/19 07:28:40
ditto as fetch-event.html
tyoshino (SeeGerritForStatus)
2016/07/19 08:50:31
Done.
|
| + var header_names = []; |
| + for (var i in headers) { |
| + header_names.push(headers[i][0]); |
| + } |
| + header_names.sort(); |
| + return header_names; |
| +} |
| + |
| +function get_header_test() { |
| + return xhr_send(host_info['HTTP_ORIGIN'], 'GET', '', false) |
| + .then(function(response) { |
| + assert_array_equals( |
| + get_sorted_header_name_list(response.headers), |
| + ["accept", "user-agent"], |
| + 'event.request has the expected headers for same-origin GET.'); |
| + }); |
| +} |
| + |
| +// TODO(tyoshino): Fix the stack not to include the Origin header as specified |
| +// in the spec. |
| +function post_header_test() { |
| + return xhr_send(host_info['HTTP_ORIGIN'], 'POST', '', false) |
| + .then(function(response) { |
| + assert_array_equals( |
| + get_sorted_header_name_list(response.headers), |
| + ["accept", "content-type", "origin", "user-agent"], |
| + 'event.request has the expected headers for same-origin POST.'); |
| + }); |
| +} |
| + |
| +function cross_origin_get_header_test() { |
| + return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'GET', '', false) |
| + .then(function(response) { |
| + assert_array_equals( |
| + get_sorted_header_name_list(response.headers), |
| + ["accept", "user-agent"], |
| + 'event.request has the expected headers for cross-origin GET.'); |
| + }); |
| +} |
| + |
| +// TODO(tyoshino): Fix the stack not to include the Origin header as specified |
| +// in the spec. |
| +function cross_origin_post_header_test() { |
| + return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'POST', '', false) |
| + .then(function(response) { |
| + assert_array_equals( |
| + get_sorted_header_name_list(response.headers), |
| + ["accept", "content-type", "origin", "user-agent"], |
| + 'event.request has the expected headers for cross-origin POST.'); |
| + }); |
| +} |
| + |
| function string_test() { |
| return xhr_send(host_info['HTTP_ORIGIN'], 'POST', 'test string', false) |
| .then(function(response) { |
| @@ -172,7 +225,11 @@ function data_url_test() { |
| window.addEventListener('message', function(evt) { |
| var port = evt.ports[0]; |
| - string_test() |
| + get_header_test() |
| + .then(post_header_test) |
| + .then(cross_origin_get_header_test) |
| + .then(cross_origin_post_header_test) |
| + .then(string_test) |
| .then(blob_test) |
| .then(custom_method_test) |
| .then(options_method_test) |