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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub.html

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 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Request: init with request or url</title>
6 <meta name="help" href="https://fetch.spec.whatwg.org/#request">
7 <meta name="help" href="https://url.spec.whatwg.org/#concept-url-serializer" >
8 <meta name="author" title="Canon Research France" href="https://www.crf.cano n.fr">
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 </head>
12 <body>
13 <script src="../resources/utils.js"></script>
14 <script>
15 var headers = new Headers( {"name":"value"} );
16 var emptyHeaders = new Headers();
17
18 var initValuesDict = {"method" : "POST",
19 "referrer" : "http://{{host}}:{{ports[http][0]}}/",
20 "referrerPolicy" : "origin",
21 "mode" : "same-origin",
22 "credentials" : "include",
23 "cache" : "no-cache",
24 "redirect" : "error",
25 "integrity" : "Request's Integrity",
26 "headers" : headers,
27 "body" : "Request's body"
28 };
29
30 var expectedInitialized = {"method" : "POST",
31 "referrer" : "http://{{host}}:{{ports[http][0]} }/",
32 "referrerPolicy" : "origin",
33 "mode" : "same-origin",
34 "credentials" : "include",
35 "cache" : "no-cache",
36 "redirect" : "error",
37 "integrity" : "Request's Integrity",
38 "headers" : headers,
39 "body" : "Request's body"
40 };
41
42 var expectedDefault = {"method" : "GET",
43 "url" : location.href,
44 "referrer" : "http://{{host}}:{{ports[http][0]}}/",
45 "referrerPolicy" : "",
46 "mode" : "cors",
47 "credentials" : "omit",
48 "cache" : "default",
49 "redirect" : "follow",
50 "integrity" : "",
51 "headers" : emptyHeaders
52 };
53
54 var requestDefault = new Request("");
55 var requestInitialized = new Request("", initValuesDict);
56
57 test(function() {
58 var requestToCheck = new Request(requestInitialized);
59 checkRequest(requestToCheck, expectedInitialized);
60 }, "Check request values when initialized from Request");
61
62 test(function() {
63 var requestToCheck = new Request(requestDefault, initValuesDict);
64 checkRequest(requestToCheck, expectedInitialized);
65 }, "Check request values when initialized from Request and init values");
66
67 test(function() {
68 var url = "http://url.test:1234/path/subpath?query=true";
69 url += "#fragment";
70 expectedDefault["url"] = url;
71 var requestToCheck = new Request(url);
72 checkRequest(requestToCheck, expectedDefault);
73 }, "Check request values when initialized from url string");
74
75 test(function() {
76 var url = "http://url.test:1234/path/subpath?query=true";
77 url += "#fragment";
78 expectedInitialized["url"] = url;
79 var requestToCheck = new Request(url , initValuesDict);
80 checkRequest(requestToCheck, expectedInitialized);
81 }, "Check request values when initialized from url and init values");
82 </script>
83 </body>
84 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698