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

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

Issue 2204683002: Cache API should not match() HEAD requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HEAD -> Head 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 prepopulated_cache_test(simple_entries, function(cache, entries) { 6 prepopulated_cache_test(simple_entries, function(cache, entries) {
7 return cache.match('not-present-in-the-cache') 7 return cache.match('not-present-in-the-cache')
8 .then(function(result) { 8 .then(function(result) {
9 assert_equals(result, undefined, 9 assert_equals(result, undefined,
10 'Cache.match failures should resolve with undefined.'); 10 'Cache.match failures should resolve with undefined.');
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 prepopulated_cache_test(simple_entries, function(cache, entries) { 47 prepopulated_cache_test(simple_entries, function(cache, entries) {
48 return cache.match(new Request(entries.a.request.url)) 48 return cache.match(new Request(entries.a.request.url))
49 .then(function(result) { 49 .then(function(result) {
50 assert_response_equals(result, entries.a.response, 50 assert_response_equals(result, entries.a.response,
51 'Cache.match should match by Request.'); 51 'Cache.match should match by Request.');
52 }); 52 });
53 }, 'Cache.match with new Request'); 53 }, 'Cache.match with new Request');
54 54
55 prepopulated_cache_test(simple_entries, function(cache, entries) { 55 prepopulated_cache_test(simple_entries, function(cache, entries) {
56 return cache.match(new Request(entries.a.request.url, {method: 'HEAD'}))
57 .then(function(result) {
58 assert_equals(result, undefined,
59 'Cache.match should not match HEAD Request.');
60 });
61 }, 'Cache.match with HEAD');
62
63 prepopulated_cache_test(simple_entries, function(cache, entries) {
56 return cache.match(entries.a.request, 64 return cache.match(entries.a.request,
57 {ignoreSearch: true}) 65 {ignoreSearch: true})
58 .then(function(result) { 66 .then(function(result) {
59 assert_response_in_array( 67 assert_response_in_array(
60 result, 68 result,
61 [ 69 [
62 entries.a.response, 70 entries.a.response,
63 entries.a_with_query.response 71 entries.a_with_query.response
64 ], 72 ],
65 'Cache.match with ignoreSearch should ignore the ' + 73 'Cache.match with ignoreSearch should ignore the ' +
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return cache.match(entries.error_response.request.url) 238 return cache.match(entries.error_response.request.url)
231 .then(function(result) { 239 .then(function(result) {
232 assert_response_equals( 240 assert_response_equals(
233 result, entries.error_response.response, 241 result, entries.error_response.response,
234 'Cache.match should return a Response object that has the ' + 242 'Cache.match should return a Response object that has the ' +
235 'same properties as a stored network error response.'); 243 'same properties as a stored network error response.');
236 }); 244 });
237 }, 'Cache.match with a network error Response'); 245 }, 'Cache.match with a network error Response');
238 246
239 done(); 247 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698