Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js |
| index 07e5306eb5ecb75ed038d0dde3ca252877e306c0..1e59c4d70fc6f4a52087d013797e938fd674d0e3 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js |
| @@ -29,6 +29,11 @@ promise_test(function(t) { |
| assert_equals(response.headers.get('Content-Type'), |
| 'text/plain;charset=US-ASCII'); |
| assert_equals(size(response.headers), 1); |
| + if (self.internals) { |
| + assert_array_equals( |
| + ['data:,Foobar'], |
| + self.internals.getInternalResponseURLList(response)); |
|
falken
2016/12/09 01:54:15
nit: actual and expected parameters are flipped (t
horo
2016/12/09 05:04:11
Done.
|
| + } |
| return response.text(); |
| }) |
| .then(function(text) { |
| @@ -44,6 +49,11 @@ promise_test(function(t) { |
| assert_equals(response.headers.get('Content-Type'), |
| 'text/html;charset=utf-8'); |
| assert_equals(size(response.headers), 1); |
| + if (self.internals) { |
| + assert_array_equals( |
| + ['data:text/html;charset=utf-8;base64,5paH5a2X'], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| return response.text(); |
| }) |
| .then(function(text) { |
| @@ -70,6 +80,10 @@ if ('createObjectURL' in URL) { |
| assert_equals(response.headers.get('Content-Type'), 'text/fox'); |
| assert_equals(response.headers.get('Content-Length'), '3'); |
| assert_equals(size(response.headers), 2); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [url], self.internals.getInternalResponseURLList(response)); |
| + } |
| return response.text(); |
| }) |
| .then(function(text) { |
| @@ -98,18 +112,30 @@ promise_test(function(t) { |
| }, 'fetch of scheme not listed in basic fetch spec'); |
| promise_test(function(t) { |
| - return fetch('/fetch/resources/fetch-status.php?status=200') |
| + var request = new Request('/fetch/resources/fetch-status.php?status=200'); |
| + return fetch(request) |
| .then(function(response) { |
| assert_equals(response.status, 200); |
| assert_equals(response.statusText, 'OK'); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [request.url], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| }); |
| }, 'Fetch result of 200 response'); |
| promise_test(function(t) { |
| - return fetch('/fetch/resources/fetch-status.php?status=404') |
| + var request = new Request('/fetch/resources/fetch-status.php?status=404'); |
| + return fetch(request) |
| .then(function(response) { |
| assert_equals(response.status, 404); |
| assert_equals(response.statusText, 'Not Found'); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [request.url], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| }); |
| }, 'Fetch result of 404 response'); |
| @@ -130,8 +156,13 @@ promise_test(function(t) { |
| // if response's url is null and response's url, |
| // serialized with the exclude fragment flag set, otherwise. |
| assert_equals(response.url, |
| - BASE_ORIGIN + |
| - '/fetch/resources/fetch-status.php?status=200'); |
| + BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200'); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [BASE_ORIGIN + |
| + '/fetch/resources/fetch-status.php?status=200#fragment'], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| }); |
| }, 'Request/response url attribute getter with fragment'); |
| @@ -155,6 +186,11 @@ promise_test(function(t) { |
| 'Response\'s url is locationURL'); |
| assert_equals(request.url, redirect_original_url, |
| 'Request\'s url remains the original URL'); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [request.url, response.url], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| }); |
| }, 'Request/response url attribute getter with redirect'); |
| @@ -175,6 +211,11 @@ promise_test(function(t) { |
| assert_equals(response.status, 0); |
| assert_equals(response.type, 'opaqueredirect'); |
| assert_equals(response.url, request.url); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [redirect_original_url], |
| + self.internals.getInternalResponseURLList(response)); |
| + } |
| }); |
| }, 'Manual redirect fetch returns opaque redirect response'); |
| @@ -225,6 +266,10 @@ promise_test(function(test) { |
| assert_equals(response.status, 200); |
| assert_equals(response.statusText, 'OK'); |
| assert_equals(response.url, url); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [url], self.internals.getInternalResponseURLList(response)); |
| + } |
| return response.text(); |
| }) |
| .then(function(text) { assert_equals(text, '<!DOCTYPE html>\n'); }) |
| @@ -237,6 +282,10 @@ promise_test(function(test) { |
| assert_equals(response.status, 200); |
| assert_equals(response.statusText, 'OK'); |
| assert_equals(response.url, url); |
| + if (self.internals) { |
| + assert_array_equals( |
| + [url], self.internals.getInternalResponseURLList(response)); |
| + } |
| return response.text(); |
| }) |
| .then(function(text) { assert_equals(text, '<!DOCTYPE html>\n'); }) |