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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-to-dataurl.js

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/redirect/redirect-to-dataurl.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-to-dataurl.js b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-to-dataurl.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3bae3f6bb0847b7d4e4da929b9fa83abd49aab6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/redirect/redirect-to-dataurl.js
@@ -0,0 +1,30 @@
+if (this.document === undefined) {
+ importScripts("/common/get-host-info.sub.js")
+ importScripts("/resources/testharness.js");
+}
+
+var dataURL = "data:text/plain;base64,cmVzcG9uc2UncyBib2R5";
+var body = "response's body";
+var contentType = "text/plain";
+
+function redirectDataURL(desc, redirectUrl, mode) {
+ var url = redirectUrl + "?cors&location=" + encodeURIComponent(dataURL);
+
+ var requestInit = {"mode": mode};
+
+ promise_test(function(test) {
+ return promise_rejects(test, new TypeError(), fetch(url, requestInit));
+ }, desc);
+}
+
+var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py";
+var corsRedirUrl = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/redirect.py";
+
+redirectDataURL("Testing data URL loading after same-origin redirection (cors mode)", redirUrl, "cors");
+redirectDataURL("Testing data URL loading after same-origin redirection (no-cors mode)", redirUrl, "no-cors");
+redirectDataURL("Testing data URL loading after same-origin redirection (same-origin mode)", redirUrl, "same-origin");
+
+redirectDataURL("Testing data URL loading after cross-origin redirection (cors mode)", corsRedirUrl, "cors");
+redirectDataURL("Testing data URL loading after cross-origin redirection (no-cors mode)", corsRedirUrl, "no-cors");
+
+done();

Powered by Google App Engine
This is Rietveld 408576698