Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js

Issue 2550363002: Add LayoutTests for URL list of Response (Closed)
Patch Set: s/thired/third/ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9f21bbea19043875c96caef71d36c086d86a7ffe..31d97ad4d3f43dcdcb121e5271b9268c3681d0bf 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(
+ self.internals.getInternalResponseURLList(response),
+ ['data:,Foobar']);
+ }
return response.text();
})
.then(function(text) {
@@ -63,6 +68,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(
+ self.internals.getInternalResponseURLList(response),
+ ['data:text/html;charset=utf-8;base64,5paH5a2X']);
+ }
return response.text();
})
.then(function(text) {
@@ -89,6 +99,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(
+ self.internals.getInternalResponseURLList(response), [url]);
+ }
return response.text();
})
.then(function(text) {
@@ -117,18 +131,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(
+ self.internals.getInternalResponseURLList(response),
+ [request.url]);
+ }
});
}, '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(
+ self.internals.getInternalResponseURLList(response),
+ [request.url]);
+ }
});
}, 'Fetch result of 404 response');
@@ -149,8 +175,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(
+ self.internals.getInternalResponseURLList(response),
+ [BASE_ORIGIN +
+ '/fetch/resources/fetch-status.php?status=200#fragment']);
+ }
});
}, 'Request/response url attribute getter with fragment');
@@ -174,6 +205,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(
+ self.internals.getInternalResponseURLList(response),
+ [request.url, response.url]);
+ }
});
}, 'Request/response url attribute getter with redirect');
@@ -194,6 +230,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(
+ self.internals.getInternalResponseURLList(response),
+ [redirect_original_url]);
+ }
});
}, 'Manual redirect fetch returns opaque redirect response');
@@ -244,6 +285,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(
+ self.internals.getInternalResponseURLList(response), [url]);
+ }
return response.text();
})
.then(function(text) { assert_equals(text, '<!DOCTYPE html>\n'); })
@@ -256,6 +301,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(
+ self.internals.getInternalResponseURLList(response), [url]);
+ }
return response.text();
})
.then(function(text) { assert_equals(text, '<!DOCTYPE html>\n'); })

Powered by Google App Engine
This is Rietveld 408576698