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

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

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/fetch/script-tests/thorough/redirect.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
index 2ddfe780fff050146a0f02f7572549cf927d31dd..3cb991f9aa784de7eb84fe7fc5dfca24cd51a90c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/thorough/redirect.js
@@ -8,7 +8,7 @@ var TEST_TARGETS = [
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=GET',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, authCheck1]],
// https://fetch.spec.whatwg.org/#concept-http-fetch
@@ -16,7 +16,8 @@ var TEST_TARGETS = [
// Step 2: If location is null, return response.
[REDIRECT_URL + 'noLocation' +
'&mode=same-origin&method=GET&NoRedirectTest=true',
- [fetchResolved, hasBody, typeBasic, checkURLList.bind(self, [])],
+ [fetchResolved, hasBody, typeBasic, responseNotRedirected,
+ checkURLList.bind(self, [])],
[checkJsonpNoRedirect]],
// Step 5: If locationURL is failure, return a network error.
[REDIRECT_URL + 'http://' +
@@ -26,33 +27,33 @@ var TEST_TARGETS = [
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=GET&headers=CUSTOM',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, hasCustomHeader, authCheck1]],
// Chrome changes the method from POST to GET when it recieves 301 redirect
// response. See a note in http://tools.ietf.org/html/rfc7231#section-6.4.2
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=POST&Status=301',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, authCheck1]],
// Chrome changes the method from POST to GET when it recieves 302 redirect
// response. See a note in http://tools.ietf.org/html/rfc7231#section-6.4.3
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=POST',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, authCheck1]],
// GET method must be used for 303 redirect.
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=POST&Status=303',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, authCheck1]],
// The 307 redirect response doesn't change the method.
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&method=POST&Status=307',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsPOST, authCheck1]],
// The 308 redirect response doesn't change the method.
// FIXME: currently this and following 308 tests are disabled because they
@@ -67,19 +68,20 @@ var TEST_TARGETS = [
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&credentials=same-origin&method=POST&Status=201&' +
'NoRedirectTest=true',
- [fetchResolved, hasBody, typeBasic, checkURLList.bind(self, [])],
+ [fetchResolved, hasBody, typeBasic,
+ responseNotRedirected, checkURLList.bind(self, [])],
[checkJsonpNoRedirect]],
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=same-origin&credentials=same-origin&method=PUT',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsPUT, authCheck1]],
[REDIRECT_URL + encodeURIComponent(BASE_URL) +
'&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic,
- checkURLList.bind(self, [BASE_URL])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL])],
[methodIsGET, hasCustomHeader, authCheck1]],
// Redirect: same origin -> other origin
@@ -103,6 +105,7 @@ var TEST_TARGETS = [
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=GET',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*'])],
[methodIsGET, authCheckNone]],
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
@@ -112,6 +115,7 @@ var TEST_TARGETS = [
encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*&ACAMethods=PUT') +
'&mode=cors&credentials=same-origin&method=PUT',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*&ACAMethods=PUT'])],
[methodIsPUT, noCustomHeader, authCheckNone]],
@@ -120,24 +124,28 @@ var TEST_TARGETS = [
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*'])],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*'])],
[methodIsGET]],
// GET method must be used for 303 redirect.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*'])],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + '&ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + '&ACAOrigin=*'])],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
@@ -154,6 +162,7 @@ var TEST_TARGETS = [
'ACAOrigin=*&ACAHeaders=x-serviceworker-test') +
'&mode=cors&credentials=same-origin&method=GET&headers=CUSTOM',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(
self,
[OTHER_BASE_URL + 'ACAOrigin=*&ACAHeaders=x-serviceworker-test'])],
@@ -175,6 +184,7 @@ var TEST_TARGETS = [
'&ACEHeaders=Content-Length, X-ServiceWorker-ServerHeader') +
'&mode=cors&credentials=same-origin&method=GET',
[fetchResolved, hasContentLength, hasServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(
self,
[OTHER_BASE_URL +'&ACAOrigin=' + BASE_ORIGIN +
@@ -198,6 +208,7 @@ var TEST_TARGETS = [
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
[methodIsGET, authCheckNone]],
@@ -206,25 +217,25 @@ var TEST_TARGETS = [
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
- checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
- checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// GET method must be used for 303 redirect.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
- checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[OTHER_REDIRECT_URL + encodeURIComponent(BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=post&ACAOrigin=*&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
- checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
+ responseRedirected, checkURLList.bind(self, [BASE_URL + 'ACAOrigin=*'])],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
// FIXME: disabled due to https://crbug.com/451938
@@ -262,18 +273,21 @@ var TEST_TARGETS = [
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL +
encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=' + BASE_ORIGIN + '') +
'&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=' + BASE_ORIGIN])],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=GET' +
'&ACAOrigin=' + BASE_ORIGIN + '',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsGET, authCheckNone]],
[OTHER_REDIRECT_URL +
@@ -281,6 +295,7 @@ var TEST_TARGETS = [
'&mode=cors&credentials=same-origin&method=GET' +
'&ACAOrigin=' + BASE_ORIGIN + '',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=' + BASE_ORIGIN])],
[methodIsGET, authCheckNone]],
@@ -289,24 +304,28 @@ var TEST_TARGETS = [
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=301',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// The 302 redirect response MAY change the request method from POST to GET.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=302',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// GET method must be used for 303 redirect.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=303',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsGET]],
// The 307 redirect response MUST NOT change the method.
[OTHER_REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*') +
'&mode=cors&credentials=same-origin&method=POST&ACAOrigin=*&Status=307',
[fetchResolved, noContentLength, noServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(self, [OTHER_BASE_URL + 'ACAOrigin=*'])],
[methodIsPOST]],
// The 308 redirect response MUST NOT change the method.
@@ -322,6 +341,7 @@ var TEST_TARGETS = [
'ACAOrigin=*&ACEHeaders=X-ServiceWorker-ServerHeader') +
'&mode=cors&credentials=same-origin&method=GET&ACAOrigin=*',
[fetchResolved, noContentLength, hasServerHeader, hasBody, typeCors,
+ responseRedirected,
checkURLList.bind(
self,
[OTHER_BASE_URL +

Powered by Google App Engine
This is Rietveld 408576698