Files
firefox/testing/web-platform/tests/fetch/api/request/request-cache-default-conditional.any.js
Maxim Tsoy ef5da561dd Bug 1673485 [wpt PR 26296] - Convert some Fetch tests to multi-global .any.js, a=testonly
Automatic update from web-platform-tests
Convert some Fetch tests to multi-global .any.js

Fixes #21163
--

wpt-commits: 9907f5871e78b10ba4e1d2e60c18c76977f18ec7
wpt-pr: 26296
2020-11-04 10:10:07 +00:00

171 lines
7.2 KiB
JavaScript

// META: global=window,worker
// META: title=Request cache - default with conditional requests
// META: timeout=long
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=request-cache.js
var tests = [
{
name: 'RequestCache "default" mode with an If-Modified-Since header (following a request without additional headers) is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Modified-Since header (following a request without additional headers) is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Modified-Since": now.toGMTString()}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Modified-Since header is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{"If-Modified-Since": now.toGMTString()}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-None-Match header (following a request without additional headers) is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{}, {"If-None-Match": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-None-Match header (following a request without additional headers) is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{}, {"If-None-Match": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{"If-None-Match": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-None-Match header is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{"If-None-Match": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Unmodified-Since header (following a request without additional headers) is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Unmodified-Since header (following a request without additional headers) is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Unmodified-Since": now.toGMTString()}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Unmodified-Since header is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{"If-Unmodified-Since": now.toGMTString()}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Match header (following a request without additional headers) is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Match": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Match header (following a request without additional headers) is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Match": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{"If-Match": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Match header is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{"If-Match": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Range header (following a request without additional headers) is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Range": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Range header (following a request without additional headers) is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{}, {"If-Range": '"foo"'}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [false, true],
},
{
name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
state: "stale",
request_cache: ["default", "default"],
request_headers: [{"If-Range": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
{
name: 'RequestCache "default" mode with an If-Range header is treated similarly to "no-store"',
state: "fresh",
request_cache: ["default", "default"],
request_headers: [{"If-Range": '"foo"'}, {}],
expected_validation_headers: [false, false],
expected_no_cache_headers: [true, false],
},
];
run_tests(tests);