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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/redirected-response.html

Issue 2524703002: Introduce Response.redirect attribute and add LayoutTest. (Closed)
Patch Set: 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/serviceworker/redirected-response.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/redirected-response.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/redirected-response.html
index 4cb8354d3a810114d8c2112991f8868132ae7cbd..56b7bdb84fcb675178511b23a44199d911d203f5 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/redirected-response.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/redirected-response.html
@@ -9,9 +9,16 @@
function redirected_test(url,
fetch_method,
cache,
+ expected_redirected,
expected_url_list) {
return fetch_method(url).then(response => {
var cloned_response = response.clone();
+ assert_equals(
+ response.redirected, expected_redirected,
+ 'The redirected flag of response must match. URL: ' + url);
+ assert_equals(
+ cloned_response.redirected, expected_redirected,
+ 'The redirected flag of cloned response must match. URL: ' + url);
if (self.internals) {
assert_array_equals(
self.internals.getInternalResponseURLList(response),
@@ -26,6 +33,9 @@ function redirected_test(url,
})
.then(_ => cache.match(url))
.then(response => {
+ assert_equals(response.redirected, expected_redirected,
+ 'The redirected flag of response in CacheStorage must match. URL: ' +
+ url);
if (self.internals) {
assert_array_equals(
self.internals.getInternalResponseURLList(response),
@@ -62,17 +72,21 @@ promise_test(t => {
frame = f;
return Promise.all([
redirected_test(TARGET_URL, self.fetch, cache,
+ false /* expected_redirected */,
[TARGET_URL]),
redirected_test(REDIRECT_TO_TARGET_URL, self.fetch, cache,
+ true /* expected_redirected */,
[REDIRECT_TO_TARGET_URL, TARGET_URL]),
redirected_test('./?url=' + encodeURIComponent(TARGET_URL),
frame.contentWindow.fetch,
cache,
+ false /* expected_redirected */,
[TARGET_URL]),
redirected_test(
'./?url=' + encodeURIComponent(REDIRECT_TO_TARGET_URL),
frame.contentWindow.fetch,
cache,
+ true /* expected_redirected */,
[REDIRECT_TO_TARGET_URL, TARGET_URL]),
]);
})
@@ -81,5 +95,5 @@ promise_test(t => {
frame.remove();
return service_worker_unregister(t, SCOPE);
});
- }, 'Verify URL list of responses.');
+ }, 'Verify redirected flag of responses.');
</script>

Powered by Google App Engine
This is Rietveld 408576698