66// META: script=http-cache.js
77/*
88NOTE for testing No-Vary-Search-Header:
9- If `params` is set to true, `expect=("dispatch" "uuid")` must be specified.
10- Otherwise:
11- - The same HTTP Cache will be used by other tests, which are supposed
12- to be distinguished by uuid.
13- - The test utility cannot get the server's states because UA will use the HTTP
14- Cache instead of sending a new request to server to ask for the latest state.
9+ - If `params` is set to true, `expect=("dispatch" "uuid")` must be specified.
10+ Otherwise:
11+ - The same HTTP Cache will be used by other tests, which are supposed
12+ to be distinguished by uuid.
13+ - The test utility cannot get the server's states because UA will use the HTTP
14+ Cache instead of sending a new request to server to ask for the latest state.
15+ - Do not test not_cached cases and cached cases within one test. Test infra
16+ checks the number of requests and responses without considering if the
17+ previous responses should be served from cache or not.
1518*/
1619var tests = [
1720 {
@@ -28,6 +31,61 @@ var tests = [
2831 expected_type : "cached"
2932 }
3033 ]
34+ } ,
35+ {
36+ name : "Ground truth: When key-order is not set, URLs should be compared in an order-sensitive way." ,
37+ requests : [
38+ {
39+ url_params : "a=1&b=2" ,
40+ response_headers : [
41+ [ "Cache-Control" , "max-age=10000" ] ,
42+ ] ,
43+ } ,
44+ {
45+ url_params : "b=2&a=1" ,
46+ expected_type : "not_cached"
47+ }
48+ ]
49+ } ,
50+ {
51+ name : "When key-order is set , URLs should be compared in an order-insensitive way. Matched cases:" ,
52+ requests : [
53+ {
54+ url_params : "a=1&b=2" ,
55+ response_headers : [
56+ [ "Cache-Control" , "max-age=10000" ] ,
57+ [ "No-Vary-Search" , "key-order" ] ,
58+ ] ,
59+ } ,
60+ {
61+ url_params : "b=2&a=1" ,
62+ expected_type : "cached"
63+ }
64+ ]
65+ } ,
66+ {
67+ name : "When key-order is set , URLs should be compared in an order-insensitive way. Not matched cases" ,
68+ requests : [
69+ {
70+ url_params : "a=1&b=2" ,
71+ response_headers : [
72+ [ "Cache-Control" , "max-age=10000" ] ,
73+ [ "No-Vary-Search" , "key-order" ] ,
74+ ] ,
75+ } ,
76+ {
77+ url_params : "b=2" ,
78+ expected_type : "not_cached"
79+ } ,
80+ {
81+ url_params : "a=2&b=2" ,
82+ expected_type : "not_cached"
83+ } ,
84+ {
85+ url_params : "a=1&b=2&c=3" ,
86+ expected_type : "not_cached"
87+ }
88+ ]
3189 }
3290] ;
3391run_tests ( tests ) ;
0 commit comments