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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/basic/mode-no-cors.js

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 if (this.document === undefined) {
2 importScripts("/resources/testharness.js");
3 importScripts("../resources/utils.js");
4 }
5
6 function fetchNoCors(url, isOpaqueFiltered) {
7 var urlQuery = "?pipe=header(x-is-filtered,value)"
8 promise_test(function(test) {
9 if (isOpaqueFiltered)
10 return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) {
11 assert_equals(resp.status, 0, "Opaque filter: status is 0");
12 assert_equals(resp.statusText, "", "Opaque filter: statusText is \"\"");
13 assert_equals(resp.type , "opaque", "Opaque filter: response's type is o paque");
14 assert_equals(resp.headers.get("x-is-filtered"), null, "Header x-is-filt ered is filtered");
15 });
16 else
17 return fetch(url + urlQuery, {"mode": "no-cors"}).then(function(resp) {
18 assert_equals(resp.status, 200, "HTTP status is 200");
19 assert_equals(resp.type , "basic", "Response's type is basic");
20 assert_equals(resp.headers.get("x-is-filtered"), "value", "Header x-is-f iltered is not filtered");
21 });
22 }, "Fetch "+ url + " with no-cors mode");
23 }
24
25 fetchNoCors(RESOURCES_DIR + "top.txt", false);
26 fetchNoCors("http://{{host}}:{{ports[http][0]}}/fetch/api/resources/top.txt", fa lse);
27 fetchNoCors("https://{{host}}:{{ports[https][0]}}/fetch/api/resources/top.txt", true);
28 fetchNoCors("http://{{host}}:{{ports[http][1]}}/fetch/api/resources/top.txt", tr ue);
29
30 done();
31
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698