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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-clone.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 clone</title>
6 <meta name="help" href="https://fetch.spec.whatwg.org/#request">
7 <meta name="author" title="Canon Research France" href="https://www.crf.cano n.fr">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script src="../resources/utils.js"></script>
11 </head>
12 <body>
13 <script>
14 var headers = new Headers({"name" : "value"});
15 var emptyHeaders = new Headers();
16
17 var initValuesDict = {"method" : "POST",
18 "referrer" : "http://{{host}}:{{ports[http][0]}}/",
19 "referrerPolicy" : "origin",
20 "mode" : "same-origin",
21 "credentials" : "include",
22 "cache" : "no-cache",
23 "redirect" : "error",
24 "integrity" : "Request's Integrity",
25 "headers" : headers,
26 "body" : "Request's body"
27 };
28
29 var expectedInitialized = {"method" : "POST",
30 "referrer" : "http://{{host}}:{{ports[http][0]} }/",
31 "referrerPolicy" : "origin",
32 "mode" : "same-origin",
33 "credentials" : "include",
34 "cache" : "no-cache",
35 "redirect" : "error",
36 "integrity" : "Request's Integrity",
37 "headers" : headers,
38 "body" : "Request's body"
39 };
40
41 test(function() {
42 var RequestInitialized = new Request("", initValuesDict);
43 var requestToCheck = RequestInitialized.clone();
44 checkRequest(requestToCheck, expectedInitialized);
45 }, "Check cloning a request");
46
47 test(function() {
48 var initialRequest = new Request("", {"headers" : new Headers({"a": "1", "b" : "2"})});
49 var request = initialRequest.clone();
50 assert_equals(request.headers.get("a"), "1", "cloned request should have header 'a'");
51 assert_equals(request.headers.get("b"), "2", "cloned request should have header 'b'");
52
53 initialRequest.headers.delete("a");
54 assert_equals(request.headers.get("a"), "1", "cloned request should stil l have header 'a'");
55
56 request.headers.delete("a");
57 assert_equals(initialRequest.headers.get("b"), "2", "initial request sho uld have header 'b'");
58
59 }, "Check cloning a request copies the headers");
60
61 </script>
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698