request-cache-force-cache.any.js (2595B)
1 // META: global=window,worker 2 // META: title=Request cache - force-cache 3 // META: script=/common/utils.js 4 // META: script=/common/get-host-info.sub.js 5 // META: script=request-cache.js 6 7 var tests = [ 8 { 9 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses', 10 state: "stale", 11 request_cache: ["default", "force-cache"], 12 expected_validation_headers: [false], 13 expected_no_cache_headers: [false], 14 }, 15 { 16 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses', 17 state: "fresh", 18 request_cache: ["default", "force-cache"], 19 expected_validation_headers: [false], 20 expected_no_cache_headers: [false], 21 }, 22 { 23 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found', 24 state: "stale", 25 request_cache: ["force-cache"], 26 expected_validation_headers: [false], 27 expected_no_cache_headers: [false], 28 }, 29 { 30 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response is not found', 31 state: "fresh", 32 request_cache: ["force-cache"], 33 expected_validation_headers: [false], 34 expected_no_cache_headers: [false], 35 }, 36 { 37 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary', 38 state: "stale", 39 vary: "*", 40 request_cache: ["default", "force-cache"], 41 expected_validation_headers: [false, true], 42 expected_no_cache_headers: [false, false], 43 }, 44 { 45 name: 'RequestCache "force-cache" mode checks the cache for previously cached content and goes to the network if a cached response would vary', 46 state: "fresh", 47 vary: "*", 48 request_cache: ["default", "force-cache"], 49 expected_validation_headers: [false, true], 50 expected_no_cache_headers: [false, false], 51 }, 52 { 53 name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network', 54 state: "stale", 55 request_cache: ["force-cache", "default"], 56 expected_validation_headers: [false, true], 57 expected_no_cache_headers: [false, false], 58 }, 59 { 60 name: 'RequestCache "force-cache" stores the response in the cache if it goes to the network', 61 state: "fresh", 62 request_cache: ["force-cache", "default"], 63 expected_validation_headers: [false], 64 expected_no_cache_headers: [false], 65 }, 66 ]; 67 run_tests(tests);