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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-static-redirect.html

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 years, 9 months 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/external/wpt/fetch/api/response/response-static-redirect.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-static-redirect.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-static-redirect.html
new file mode 100644
index 0000000000000000000000000000000000000000..e09c6661193403da1504f09e7639356cb0012e8f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-static-redirect.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Response: redirect static method</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#response">
+ <meta name="help" href="https://fetch.spec.whatwg.org/#redirect-status">
+ <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ var url = "http://test.url:1234/";
+ test(function() {
+ redirectResponse = Response.redirect(url);
+ assert_equals(redirectResponse.status, 302, "Default redirect status is 302");
+ assert_equals(redirectResponse.headers.get("Location"), url,
+ "redirected response has Location header with the correct url");
+ }, "Check default redirect response");
+
+ var redirectStatus = [301, 302, 303, 307, 308];
+ redirectStatus.forEach(function(status) {
+ test(function() {
+ redirectResponse = Response.redirect(url, status);
+ assert_equals(redirectResponse.status, status, "Redirect status is " + status);
+ }, "Check response returned by static method redirect(), status = " + status);
+ });
+
+ test(function() {
+ var invalidUrl = "http://:This is not an url";
+ assert_throws(new TypeError(), function() { Response.redirect(invalidUrl); },
+ "Expect TypeError exception");
+ }, "Check error returned when giving invalid url to redirect()");
+
+ var invalidRedirectStatus = [200, 309, 400, 500];
+ invalidRedirectStatus.forEach(function(invalidStatus) {
+ test(function() {
+ assert_throws(new RangeError() , function() { Response.redirect(url, invalidStatus); },
+ "Expect RangeError exception");
+ }, "Check error returned when giving invalid status to redirect(), status = " + invalidStatus);
+ });
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698