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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/freshness.html

Issue 2778753002: Import //fetch from Web Platform Tests. (Closed)
Patch Set: Baselines. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/freshness.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/freshness.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/freshness.html
new file mode 100644
index 0000000000000000000000000000000000000000..e15d1b42c92aa48474beda74e88f9eb24ec2c3b8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/http-cache/freshness.html
@@ -0,0 +1,226 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>HTTP Cache - Freshness</title>
+ <meta name="help" href="https://fetch.spec.whatwg.org/#request">
+ <meta name="timeout" content="long">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <script src="/common/get-host-info.sub.js"></script>
+ <script src="http-cache.js"></script>
+ </head>
+ <body>
+ <script>
+ var tests = [
+ // response directives
+ {
+ name: 'HTTP cache reuses a response with a future Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Expires", http_date(30*24*60*60)]
+ ]
+ },
+ {
+ expected_type: "cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response with a past Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Expires", http_date(-30*24*60*60)]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response with a present Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Expires", http_date(0)]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response with an invalid Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Expires", "0"]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache reuses a response with positive Cache-Control: max-age.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=3600"]
+ ]
+ },
+ {
+ expected_type: "cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response with Cache-Control: max-age=0.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=0"]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=3600"],
+ ['Expires', http_date(-10000)]
+ ]
+ },
+ {
+ expected_type: "cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=3600"],
+ ['Expires', '0']
+ ]
+ },
+ {
+ expected_type: "cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response with Cache-Control: max-age=0 and a future Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=0"],
+ ['Expires', http_date(10000)]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not prefer Cache-Control: s-maxage over Cache-Control: max-age.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=1, s-maxage=3600"]
+ ],
+ pause_after: true,
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not reuse a response when the Age header is greater than its freshness lifetime.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=3600"],
+ ["Age", "12000"]
+ ],
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not store a response with Cache-Control: no-store.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "no-store"]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache does not store a response with Cache-Control: no-store, even with max-age and Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=10000, no-store"],
+ ['Expires', http_date(10000)]
+ ]
+ },
+ {
+ expected_type: "not_cached",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "no-cache"],
+ ['ETag', 'abcd']
+ ]
+ },
+ {
+ expected_type: "etag_validated",
+ }
+ ]
+ },
+ {
+ name: 'HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires.',
+ requests: [
+ {
+ response_headers: [
+ ["Cache-Control", "max-age=10000, no-cache"],
+ ['Expires', http_date(10000)],
+ ['ETag', 'abcd']
+ ]
+ },
+ {
+ expected_type: "etag_validated",
+ }
+ ]
+ },
+ ];
+ run_tests(tests);
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698