test-inputs.js (8036B)
1 // Test inputs: 2 // - description: a description of the test. 3 // - noVarySearch: No-Vary-Search header value for the response. 4 // - prefetchQuery: added to query part of prefetch-executor when prefetching 5 // - navigateQuery: added to query part of prefetch-executor when navigating 6 // - shouldUse: if the test case expects the prefetched entry to be used or not. 7 const test_inputs = [ 8 {description:"Use prefetched response as query parameter b has the same value.", 9 noVarySearch: 'params=("a")', 10 prefetchQuery: "a=2&b=3", 11 navigateQuery: "b=3", 12 shouldUse: true}, 13 14 {description:"Don't use prefetched response as query parameter b has different value.", 15 noVarySearch: 'params("a")', 16 prefetchQuery: "a=2&b=3", 17 navigateQuery: "b=2", 18 shouldUse: false}, 19 20 {description:"Use prefetched response as the URLs do not vary by a and b.", 21 noVarySearch: 'params=("a" "b")', 22 prefetchQuery: "a=2&b=3", 23 navigateQuery: "b=2", 24 shouldUse: true}, 25 26 {description:"Use prefetched response as the URLs do not vary on any query parameters.", 27 noVarySearch: "params", 28 prefetchQuery: "a=2&b=3", 29 navigateQuery: "b=4&c=5", 30 shouldUse: true}, 31 32 {description:"Use prefetched response as the URLs do not vary on any query parameters.", 33 noVarySearch: "params", 34 prefetchQuery: "", 35 navigateQuery: "b=4&c=5", 36 shouldUse: true}, 37 38 {description:"Don't use prefetched response as the URLs have different value for c.", 39 noVarySearch: "key-order", 40 prefetchQuery: "c=4&b=3&a=2", 41 navigateQuery: "a=2&c=5&b=3", 42 shouldUse: false}, 43 44 {description:"Don't use prefetched response as the URLs have the values in different order for a.", 45 noVarySearch: "key-order", 46 prefetchQuery: "b=5&a=3&a=4&d=6&c=5&b=3", 47 navigateQuery: "d=6&a=4&b=5&b=3&c=5&a=3", 48 shouldUse: false}, 49 50 {description:"Use prefetched response as the URLs have the same values for a.", 51 noVarySearch: "key-order", 52 prefetchQuery: "b=5&a=3&a=4&d=6&c=5&b=3", 53 navigateQuery: "d=6&a=3&b=5&b=3&c=5&a=4", 54 shouldUse: true}, 55 56 {description:"Use prefetched response as the URLs have the same values for a.", 57 noVarySearch: "key-order=?1", 58 prefetchQuery: "b=5&a=3&a=4&d=6&c=5&b=3", 59 navigateQuery: "d=6&a=3&b=5&b=3&c=5&a=4", 60 shouldUse: true}, 61 62 {description:"Don't use prefetched response as key-order is set to false and the URLs are not identical.", 63 noVarySearch: "key-order=?0", 64 prefetchQuery: "b=5&a=3&a=4&d=6&c=5&b=3", 65 navigateQuery: "d=6&a=3&b=5&b=3&c=5&a=4", 66 shouldUse: false}, 67 68 {description:"Use prefetched response as query parameter c can be ignored.", 69 noVarySearch: 'params=("c")', 70 prefetchQuery: "a=2&b=2&c=5", 71 navigateQuery: "a=2&c=3&b=2", 72 shouldUse: true}, 73 74 {description:"Use prefetched response as query parameter a can be ignored.", 75 noVarySearch: 'params=("a")', 76 prefetchQuery: "a=2", 77 navigateQuery: "", 78 shouldUse: true}, 79 80 {description:"Use prefetched response as query parameter a can be ignored.", 81 noVarySearch: 'params=("a")', 82 prefetchQuery: "", 83 navigateQuery: "a=2", 84 shouldUse: true}, 85 86 {description:"Use prefetched response as all query parameters except c can be ignored.", 87 noVarySearch: 'params, except=("c")', 88 prefetchQuery: "b=5&a=3&d=6&c=3", 89 navigateQuery: "a=1&b=2&c=3", 90 shouldUse: true}, 91 92 {description:"Use prefetched response as all query parameters except c can be ignored." + 93 " Only the last except matters.", 94 noVarySearch: 'params, except=("b"), except=("c")', 95 prefetchQuery: "b=5&a=3&d=6&c=3", 96 navigateQuery: "a=1&b=2&c=3", 97 shouldUse: true}, 98 99 {description:"Don't use prefetched response as even though all query parameters" + 100 " except c can be ignored, c has different value.", 101 noVarySearch: 'params, except=("c")', 102 prefetchQuery: "b=5&a=3&d=6&c=3", 103 navigateQuery: "a=1&b=2&c=5", 104 shouldUse: false}, 105 106 {description:"Use prefetched response as even though all query parameters" + 107 " except c and d can be ignored, c value matches and d value matches.", 108 noVarySearch: 'params, except=("c" "d")', 109 prefetchQuery: "b=5&a=3&d=6&c=5", 110 navigateQuery: "d=6&a=1&b=2&c=5", 111 shouldUse: true}, 112 113 {description:"Use prefetched response as even though all query parameters except" + 114 " c and d can be ignored, c value matches and d value matches." + 115 " Some query parameters to be ignored appear multiple times in the query.", 116 noVarySearch: 'params, except=("c" "d")', 117 prefetchQuery: "b=5&a=3&a=4&d=6&c=5", 118 navigateQuery: "d=6&a=1&a=2&b=2&b=3&c=5", 119 shouldUse: true}, 120 121 {description:"Use prefetched response as all query parameters except c can be ignored." + 122 " Allow extension via parameters.", 123 noVarySearch: 'params, except=("c";unknown)', 124 prefetchQuery: "b=5&a=3&d=6&c=3", 125 navigateQuery: "a=1&b=2&c=3", 126 shouldUse: true}, 127 128 {description:"Use prefetched response as query parameter c can be ignored." + 129 " Allow extension via parameters.", 130 noVarySearch: 'params=("c";unknown)', 131 prefetchQuery: "a=2&b=2&c=5", 132 navigateQuery: "a=2&c=3&b=2", 133 shouldUse: true}, 134 135 {description:"Use prefetched response as the URLs have the values in different order for a." + 136 " Allow extension via parameters.", 137 noVarySearch: "key-order;unknown", 138 prefetchQuery: "b=5&a=3&a=4&d=6&c=5&b=3", 139 navigateQuery: "d=6&a=3&b=5&b=3&c=5&a=4", 140 shouldUse: true}, 141 142 {description:"Use prefetched response as the URLs do not vary on any query parameters." + 143 " Allow extension via parameters.", 144 noVarySearch: "params;unknown", 145 prefetchQuery: "", 146 navigateQuery: "b=4&c=5", 147 shouldUse: true}, 148 149 {description:"Use prefetched response as all query parameters except c can be ignored." + 150 " Allow extension via parameters.", 151 noVarySearch: 'params;unknown, except=("c");unknown', 152 prefetchQuery: "b=5&a=3&d=6&c=3", 153 navigateQuery: "a=1&b=2&c=3", 154 shouldUse: true}, 155 156 {description:"Don't use the prefetched URL. Empty No-Vary-Search means default URL variance." + 157 " The prefetched and the navigated URLs have to be the same.", 158 noVarySearch: "", 159 prefetchQuery: "b=5&a=3&d=6&c=3", 160 navigateQuery: "a=1&b=2&c=3", 161 shouldUse: false}, 162 163 {description:"Use the prefetched URL. Empty No-Vary-Search means default URL variance." + 164 " The prefetched and the navigated URLs have to be the same.", 165 noVarySearch: "", 166 prefetchQuery: "b=5&a=3&d=6&c=3", 167 navigateQuery: "b=5&a=3&d=6&c=3", 168 shouldUse: true}, 169 170 {description:"Use the prefetched URL. Empty No-Vary-Search means default URL variance." + 171 " The prefetched and the navigated URLs have to be the same.", 172 noVarySearch: "", 173 prefetchQuery: "", 174 navigateQuery: "", 175 shouldUse: true}, 176 177 {description:"Use the prefetched URL. Non-ASCII key - 2 UTF-8 code units." + 178 " Don't vary the response on the non-ASCII key.", 179 noVarySearch: 'params=("%C2%A2")', 180 prefetchQuery: "¢=3", 181 navigateQuery: "¢=4", 182 shouldUse: true}, 183 184 {description:"Use the prefetched URL. Non-ASCII key - 2 UTF-8 code units." + 185 " Don't vary the response on the non-ASCII key.", 186 noVarySearch: 'params=("%C2%A2")', 187 prefetchQuery: "a=2&¢=3", 188 navigateQuery: "¢=4&a=2", 189 shouldUse: true}, 190 191 {description:"Don't use the prefetched URL. Non-ASCII key - 2 UTF-8 code units." + 192 " Vary the response on the non-ASCII key.", 193 noVarySearch: 'params, except=("%C2%A2")', 194 prefetchQuery: "¢=3", 195 navigateQuery: "¢=4", 196 shouldUse: false}, 197 198 {description:"Use the prefetched URL. Non-ASCII key - 2 UTF-8 code units." + 199 " Vary the response on the non-ASCII key.", 200 noVarySearch: 'params, except=("%C2%A2")', 201 prefetchQuery: "¢=3&a=4", 202 navigateQuery: "a=5&¢=3", 203 shouldUse: true}, 204 ];