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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-001.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: simple cases</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 </head>
11 <body>
12 <script>
13 var methods = {"givenValues" : ["GET", "HEAD", "POST", "PUT", "DELETE", "O PTIONS", "head"],
14 "expectedValues" : ["GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"]
15 };
16 var referrers = {"givenValues" : ["/relative/ressource",
17 "http://{{host}}:{{ports[http][0]}}/rela tive/ressource?query=true#fragment",
18 "http://{{host}}:{{ports[http][0]}}/",
19 "http://test.url",
20 "about:client",
21 ""
22 ],
23 "expectedValues" : ["http://{{host}}:{{ports[http][0]}}/r elative/ressource",
24 "http://{{host}}:{{ports[http][0]}}/r elative/ressource?query=true#fragment",
25 "http://{{host}}:{{ports[http][0]}}/" ,
26 "about:client",
27 "about:client",
28 ""
29 ]
30 };
31 var referrerPolicies = {"givenValues" : [ "",
32 "no-referrer",
33 "no-referrer-when-downgrade",
34 "origin",
35 "origin-when-cross-origin",
36 "unsafe-url",
37 "same-origin",
38 "strict-origin",
39 "strict-origin-when-cross-origin "
40 ],
41 "expectedValues" : ["",
42 "no-referrer",
43 "no-referrer-when-downgrade",
44 "origin",
45 "origin-when-cross-origin",
46 "unsafe-url",
47 "same-origin",
48 "strict-origin",
49 "strict-origin-when-cross-orig in"
50 ]
51 };
52 var modes = {"givenValues" : ["same-origin", "no-cors", "cors", "navigate" ],
53 "expectedValues" : ["same-origin", "no-cors", "cors", "same-o rigin"]
54 };
55 var credentials = {"givenValues" : ["omit", "same-origin", "include"],
56 "expectedValues" : ["omit", "same-origin", "include"]
57 };
58 var caches = {"givenValues" : [ "default", "no-store", "reload", "no-cache ", "force-cache"],
59 "expectedValues" : [ "default", "no-store", "reload", "no-ca che", "force-cache"]
60 };
61 var redirects = {"givenValues" : ["follow", "error", "manual"],
62 "expectedValues" : ["follow", "error", "manual"]
63 };
64 var integrities = {"givenValues" : ["", "AZERTYUIOP1234567890" ],
65 "expectedValues" : ["", "AZERTYUIOP1234567890"]
66 };
67
68 //there is no getter for window, init's window might be null
69 var windows = {"givenValues" : [ null ],
70 "expectedValues" : [undefined]
71 };
72
73 var initValuesDict = { "method" : methods,
74 "referrer" : referrers,
75 "referrerPolicy" : referrerPolicies,
76 "mode" : modes,
77 "credentials" : credentials,
78 "cache" : caches,
79 "redirect" : redirects,
80 "integrity" : integrities,
81 "window" : windows
82 };
83
84 for (var attributeName in initValuesDict) {
85 var valuesToTest = initValuesDict[attributeName];
86 for (var valueIdx in valuesToTest["givenValues"]) {
87 var givenValue = valuesToTest["givenValues"][valueIdx];
88 var expectedValue = valuesToTest["expectedValues"][valueIdx];
89 test(function() {
90 var requestInit = {};
91 requestInit[attributeName] = givenValue
92 var request = new Request("", requestInit);
93 assert_equals(request[attributeName], expectedValue,
94 "Expect request's " + attributeName + " is " + expectedValue + " w hen initialized with " + givenValue);
95 }, "Check " + attributeName + " init value of " + givenValue + " and a ssociated getter");
96 }
97 }
98 </script>
99 </body>
100 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698