mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
270
tests/wpt/web-platform-tests/fetch/http-cache/vary.html
Normal file
270
tests/wpt/web-platform-tests/fetch/http-cache/vary.html
Normal file
|
@ -0,0 +1,270 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>HTTP Cache - Vary</title>
|
||||
<meta name="help" href="https://fetch.spec.whatwg.org/#request">
|
||||
<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 = [
|
||||
{
|
||||
name: 'HTTP cache reuses Vary response when request matches.',
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
expected_type: "cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use Vary response when request doesn't match.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "2"]
|
||||
],
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use Vary response when request omits variant header.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
]
|
||||
},
|
||||
{
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't invalidate existing Vary response.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
],
|
||||
response_body: http_content('foo_1')
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "2"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
],
|
||||
expected_type: "not_cached",
|
||||
response_body: http_content('foo_2'),
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
expected_type: "cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't pay attention to headers not listed in Vary.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Other", "2"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo"]
|
||||
],
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Other", "3"]
|
||||
],
|
||||
expected_type: "cached",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'HTTP cache reuses two-way Vary response when request matches.',
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"]
|
||||
],
|
||||
expected_type: "cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use two-way Vary response when request doesn't match.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "2"],
|
||||
["Bar", "abc"]
|
||||
],
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use two-way Vary response when request omits variant header.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar"]
|
||||
]
|
||||
},
|
||||
{
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'HTTP cache reuses three-way Vary response when request matches.',
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"],
|
||||
["Baz", "789"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar, Baz"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"],
|
||||
["Baz", "789"]
|
||||
],
|
||||
expected_type: "cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use three-way Vary response when request doesn't match.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Bar", "abc"],
|
||||
["Baz", "789"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar, Baz"]
|
||||
]
|
||||
},
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "2"],
|
||||
["Bar", "abc"],
|
||||
["Baz", "789"]
|
||||
],
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "HTTP cache doesn't use three-way Vary response when request omits variant header.",
|
||||
requests: [
|
||||
{
|
||||
request_headers: [
|
||||
["Foo", "1"],
|
||||
["Baz", "789"]
|
||||
],
|
||||
response_headers: [
|
||||
["Expires", http_date(5000)],
|
||||
["Last-Modified", http_date(-3000)],
|
||||
["Vary", "Foo, Bar, Baz"]
|
||||
]
|
||||
},
|
||||
{
|
||||
expected_type: "not_cached"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
run_tests(tests);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue