Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1296)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-matchAll.js

Issue 2315253002: [CacheStorage] Sort QueryCache results by time entered into cache (Closed)
Patch Set: Address comments from PS5 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('/resources/testharness.js'); 2 importScripts('/resources/testharness.js');
3 importScripts('../resources/test-helpers.js'); 3 importScripts('../resources/test-helpers.js');
4 } 4 }
5 5
6 prepopulated_cache_test(simple_entries, function(cache, entries) { 6 prepopulated_cache_test(simple_entries, function(cache, entries) {
7 return cache.matchAll('not-present-in-the-cache') 7 return cache.matchAll('not-present-in-the-cache')
8 .then(function(result) { 8 .then(function(result) {
9 assert_response_array_equivalent( 9 assert_response_array_equals(
10 result, [], 10 result, [],
11 'Cache.matchAll should resolve with an empty array on failure.'); 11 'Cache.matchAll should resolve with an empty array on failure.');
12 }); 12 });
13 }, 'Cache.matchAll with no matching entries'); 13 }, 'Cache.matchAll with no matching entries');
14 14
15 prepopulated_cache_test(simple_entries, function(cache, entries) { 15 prepopulated_cache_test(simple_entries, function(cache, entries) {
16 return cache.matchAll(entries.a.request.url) 16 return cache.matchAll(entries.a.request.url)
17 .then(function(result) { 17 .then(function(result) {
18 assert_response_array_equals(result, [entries.a.response], 18 assert_response_array_equals(result, [entries.a.response],
19 'Cache.matchAll should match by URL.'); 19 'Cache.matchAll should match by URL.');
(...skipping 25 matching lines...) Expand all
45 assert_response_array_equals( 45 assert_response_array_equals(
46 result, [], 46 result, [],
47 'Cache.matchAll should not match HEAD Request.'); 47 'Cache.matchAll should not match HEAD Request.');
48 }); 48 });
49 }, 'Cache.matchAll with HEAD'); 49 }, 'Cache.matchAll with HEAD');
50 50
51 prepopulated_cache_test(simple_entries, function(cache, entries) { 51 prepopulated_cache_test(simple_entries, function(cache, entries) {
52 return cache.matchAll(entries.a.request, 52 return cache.matchAll(entries.a.request,
53 {ignoreSearch: true}) 53 {ignoreSearch: true})
54 .then(function(result) { 54 .then(function(result) {
55 assert_response_array_equivalent( 55 assert_response_array_equals(
56 result, 56 result,
57 [ 57 [
58 entries.a.response, 58 entries.a.response,
59 entries.a_with_query.response 59 entries.a_with_query.response
60 ], 60 ],
61 'Cache.matchAll with ignoreSearch should ignore the ' + 61 'Cache.matchAll with ignoreSearch should ignore the ' +
62 'search parameters of cached request.'); 62 'search parameters of cached request.');
63 }); 63 });
64 }, 64 },
65 'Cache.matchAll with ignoreSearch option (request with no search ' + 65 'Cache.matchAll with ignoreSearch option (request with no search ' +
66 'parameters)'); 66 'parameters)');
67 67
68 prepopulated_cache_test(simple_entries, function(cache, entries) { 68 prepopulated_cache_test(simple_entries, function(cache, entries) {
69 return cache.matchAll(entries.a_with_query.request, 69 return cache.matchAll(entries.a_with_query.request,
70 {ignoreSearch: true}) 70 {ignoreSearch: true})
71 .then(function(result) { 71 .then(function(result) {
72 assert_response_array_equivalent( 72 assert_response_array_equals(
73 result, 73 result,
74 [ 74 [
75 entries.a.response, 75 entries.a.response,
76 entries.a_with_query.response 76 entries.a_with_query.response
77 ], 77 ],
78 'Cache.matchAll with ignoreSearch should ignore the ' + 78 'Cache.matchAll with ignoreSearch should ignore the ' +
79 'search parameters of request.'); 79 'search parameters of request.');
80 }); 80 });
81 }, 81 },
82 'Cache.matchAll with ignoreSearch option (request with search parameters)'); 82 'Cache.matchAll with ignoreSearch option (request with search parameters)');
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 assert_response_array_equals( 127 assert_response_array_equals(
128 result, [vary_response], 128 result, [vary_response],
129 'Cache.matchAll with ignoreVary should ignore the ' + 129 'Cache.matchAll with ignoreVary should ignore the ' +
130 'vary of request.'); 130 'vary of request.');
131 }); 131 });
132 }, 'Cache.matchAll supports ignoreVary'); 132 }, 'Cache.matchAll supports ignoreVary');
133 133
134 prepopulated_cache_test(simple_entries, function(cache, entries) { 134 prepopulated_cache_test(simple_entries, function(cache, entries) {
135 return cache.matchAll(entries.cat.request.url + '#mouse') 135 return cache.matchAll(entries.cat.request.url + '#mouse')
136 .then(function(result) { 136 .then(function(result) {
137 assert_response_array_equivalent( 137 assert_response_array_equals(
138 result, 138 result,
139 [ 139 [
140 entries.cat.response, 140 entries.cat.response,
141 ], 141 ],
142 'Cache.matchAll should ignore URL fragment.'); 142 'Cache.matchAll should ignore URL fragment.');
143 }); 143 });
144 }, 'Cache.matchAll with URL containing fragment'); 144 }, 'Cache.matchAll with URL containing fragment');
145 145
146 prepopulated_cache_test(simple_entries, function(cache, entries) { 146 prepopulated_cache_test(simple_entries, function(cache, entries) {
147 return cache.matchAll('http') 147 return cache.matchAll('http')
148 .then(function(result) { 148 .then(function(result) {
149 assert_response_array_equivalent( 149 assert_response_array_equals(
150 result, [], 150 result, [],
151 'Cache.matchAll should treat query as a URL and not ' + 151 'Cache.matchAll should treat query as a URL and not ' +
152 'just a string fragment.'); 152 'just a string fragment.');
153 }); 153 });
154 }, 'Cache.matchAll with string fragment "http" as query'); 154 }, 'Cache.matchAll with string fragment "http" as query');
155 155
156 prepopulated_cache_test(simple_entries, function(cache, entries) { 156 prepopulated_cache_test(simple_entries, function(cache, entries) {
157 return cache.matchAll() 157 return cache.matchAll()
158 .then(function(result) { 158 .then(function(result) {
159 assert_response_array_equivalent( 159 assert_response_array_equals(
160 result, 160 result,
161 [ 161 [
162 entries.a.response, 162 entries.a.response,
163 entries.b.response, 163 entries.b.response,
164 entries.a_with_query.response, 164 entries.a_with_query.response,
165 entries.A.response, 165 entries.A.response,
166 entries.a_https.response, 166 entries.a_https.response,
167 entries.a_org.response, 167 entries.a_org.response,
168 entries.cat.response, 168 entries.cat.response,
169 entries.catmandu.response, 169 entries.catmandu.response,
170 entries.cat_num_lives.response, 170 entries.cat_num_lives.response,
171 entries.cat_in_the_hat.response, 171 entries.cat_in_the_hat.response,
172 entries.non_2xx_response.response, 172 entries.non_2xx_response.response,
173 entries.error_response.response 173 entries.error_response.response
174 ], 174 ],
175 'Cache.matchAll without parameters should match all entries.'); 175 'Cache.matchAll without parameters should match all entries.');
176 }); 176 });
177 }, 'Cache.matchAll without parameters'); 177 }, 'Cache.matchAll without parameters');
178 178
179 prepopulated_cache_test(vary_entries, function(cache, entries) { 179 prepopulated_cache_test(vary_entries, function(cache, entries) {
180 return cache.matchAll('http://example.com/c') 180 return cache.matchAll('http://example.com/c')
181 .then(function(result) { 181 .then(function(result) {
182 assert_response_array_equivalent( 182 assert_response_array_equals(
183 result, 183 result,
184 [ 184 [
185 entries.vary_cookie_absent.response 185 entries.vary_cookie_absent.response
186 ], 186 ],
187 'Cache.matchAll should exclude matches if a vary header is ' + 187 'Cache.matchAll should exclude matches if a vary header is ' +
188 'missing in the query request, but is present in the cached ' + 188 'missing in the query request, but is present in the cached ' +
189 'request.'); 189 'request.');
190 }) 190 })
191 191
192 .then(function() { 192 .then(function() {
193 return cache.matchAll( 193 return cache.matchAll(
194 new Request('http://example.com/c', 194 new Request('http://example.com/c',
195 {headers: {'Cookies': 'none-of-the-above'}})); 195 {headers: {'Cookies': 'none-of-the-above'}}));
196 }) 196 })
197 .then(function(result) { 197 .then(function(result) {
198 assert_response_array_equivalent( 198 assert_response_array_equals(
199 result, 199 result,
200 [ 200 [
201 ], 201 ],
202 'Cache.matchAll should exclude matches if a vary header is ' + 202 'Cache.matchAll should exclude matches if a vary header is ' +
203 'missing in the cached request, but is present in the query ' + 203 'missing in the cached request, but is present in the query ' +
204 'request.'); 204 'request.');
205 }) 205 })
206 206
207 .then(function() { 207 .then(function() {
208 return cache.matchAll( 208 return cache.matchAll(
209 new Request('http://example.com/c', 209 new Request('http://example.com/c',
210 {headers: {'Cookies': 'is-for-cookie'}})); 210 {headers: {'Cookies': 'is-for-cookie'}}));
211 }) 211 })
212 .then(function(result) { 212 .then(function(result) {
213 assert_response_array_equivalent( 213 assert_response_array_equals(
214 result, 214 result,
215 [entries.vary_cookie_is_cookie.response], 215 [entries.vary_cookie_is_cookie.response],
216 'Cache.matchAll should match the entire header if a vary header ' + 216 'Cache.matchAll should match the entire header if a vary header ' +
217 'is present in both the query and cached requests.'); 217 'is present in both the query and cached requests.');
218 }); 218 });
219 }, 'Cache.matchAll with responses containing "Vary" header'); 219 }, 'Cache.matchAll with responses containing "Vary" header');
220 220
221 prepopulated_cache_test(vary_entries, function(cache, entries) { 221 prepopulated_cache_test(vary_entries, function(cache, entries) {
222 return cache.matchAll('http://example.com/c', 222 return cache.matchAll('http://example.com/c',
223 {ignoreVary: true}) 223 {ignoreVary: true})
224 .then(function(result) { 224 .then(function(result) {
225 assert_response_array_equivalent( 225 assert_response_array_equals(
226 result, 226 result,
227 [ 227 [
228 entries.vary_cookie_is_cookie.response, 228 entries.vary_cookie_is_cookie.response,
229 entries.vary_cookie_is_good.response, 229 entries.vary_cookie_is_good.response,
230 entries.vary_cookie_absent.response 230 entries.vary_cookie_absent.response
231 ], 231 ],
232 'Cache.matchAll should support multiple vary request/response ' + 232 'Cache.matchAll should support multiple vary request/response ' +
233 'pairs.'); 233 'pairs.');
234 }); 234 });
235 }, 'Cache.matchAll with multiple vary pairs'); 235 }, 'Cache.matchAll with multiple vary pairs');
236 236
237 done(); 237 done();
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698