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

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

Issue 2204683002: Cache API should not match() HEAD requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 4 years, 4 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
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 cache_test(cache => {
7 return cache.keys()
8 .then(requests => {
9 assert_equals(
10 requests.length, 0,
11 'Cache.keys should resolve to an empty array for an empty cache');
12 });
13 }, 'Cache.keys() called on an empty cache');
14
6 prepopulated_cache_test(simple_entries, function(cache, entries) { 15 prepopulated_cache_test(simple_entries, function(cache, entries) {
7 return cache.keys('not-present-in-the-cache') 16 return cache.keys('not-present-in-the-cache')
8 .then(function(result) { 17 .then(function(result) {
9 assert_request_array_equals( 18 assert_request_array_equals(
10 result, [], 19 result, [],
11 'Cache.keys should resolve with an empty array on failure.'); 20 'Cache.keys should resolve with an empty array on failure.');
12 }); 21 });
13 }, 'Cache.keys with no matching entries'); 22 }, 'Cache.keys with no matching entries');
14 23
15 prepopulated_cache_test(simple_entries, function(cache, entries) { 24 prepopulated_cache_test(simple_entries, function(cache, entries) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 entries.catmandu.request, 125 entries.catmandu.request,
117 entries.cat_num_lives.request, 126 entries.cat_num_lives.request,
118 entries.cat_in_the_hat.request, 127 entries.cat_in_the_hat.request,
119 entries.non_2xx_response.request, 128 entries.non_2xx_response.request,
120 entries.error_response.request 129 entries.error_response.request
121 ], 130 ],
122 'Cache.keys without parameters should match all entries.'); 131 'Cache.keys without parameters should match all entries.');
123 }); 132 });
124 }, 'Cache.keys without parameters'); 133 }, 'Cache.keys without parameters');
125 134
135 prepopulated_cache_test(simple_entries, function(cache, entries) {
136 return cache.keys(new Request(entries.cat.request.url, {method: 'HEAD'}))
137 .then(function(result) {
138 assert_request_array_equals(
139 result, [],
140 'Cache.keys should not match HEAD request unless ignoreMethod ' +
141 'option is set.');
142 });
143 }, 'Cache.keys with a HEAD Request');
144
126 done(); 145 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698