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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/heuristic.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>HTTP Cache - Heuristic Freshness</title>
6 <meta name="help" href="https://fetch.spec.whatwg.org/#request">
7 <meta name="timeout" content="long">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script src="/common/utils.js"></script>
11 <script src="/common/get-host-info.sub.js"></script>
12 <script src="http-cache.js"></script>
13 </head>
14 <body>
15 <script>
16 var tests = [
17 {
18 name: 'HTTP cache reuses an unknown response with Last-Modified based up on heuristic freshness when Cache-Control: public is present.',
19 requests: [
20 {
21 response_status: [299, "Whatever"],
22 response_headers: [
23 ['Last-Modified', http_date(-3 * 100)],
24 ['Cache-Control', 'public']
25 ],
26 },
27 {
28 expected_type: "cached",
29 }
30 ]
31 },
32 {
33 name: 'HTTP cache does not reuse an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is not present.',
34 requests: [
35 {
36 response_status: [299, "Whatever"],
37 response_headers: [
38 ['Last-Modified', http_date(-3 * 100)],
39 ['Cache-Control', 'public']
40 ],
41 },
42 {
43 expected_type: "not_cached",
44 }
45 ]
46 }
47 ];
48
49 function check_status(status) {
50 var succeed = status[0];
51 var code = status[1];
52 var phrase = status[2];
53 var body = status[3];
54 if (body === undefined) {
55 body = http_content(code);
56 }
57 var expected_type = "not_cached";
58 var desired = "does not use"
59 if (succeed === true) {
60 expected_type = "cached";
61 desired = "reuses";
62 }
63 tests.push(
64 {
65 name: 'HTTP cache ' + desired + ' a ' + code + ' ' + phrase + ' respon se with Last-Modified based upon heuristic freshness.',
66 requests: [
67 {
68 response_status: [code, phrase],
69 response_headers: [
70 ['Last-Modified', http_date(-3 * 100)]
71 ],
72 response_body: body,
73 },
74 {
75 expected_type: expected_type,
76 response_status: [code, phrase],
77 response_body: body,
78 }
79 ]
80 }
81 )
82 }
83 [
84 [true, 200, 'OK'],
85 [true, 203, "Non-Authoritative Information"],
86 [true, 204, "No Content", ""],
87 [true, 404, "Not Found"],
88 [true, 405, "Method Not Allowed"],
89 [true, 410, "Gone"],
90 [true, 414, "URI Too Long"],
91 [true, 501, "Not Implemented"]
92 ].forEach(check_status);
93 [
94 [false, 201, 'Created'],
95 [false, 202, "Accepted"],
96 [false, 403, "Forbidden"],
97 [false, 502, "Bad Gateway"],
98 [false, 503, "Service Unavailable"],
99 [false, 504, "Gateway Timeout"],
100 ].forEach(check_status);
101 run_tests(tests);
102 </script>
103 </body>
104 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698