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

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

Issue 1694213002: CacheStorage: Add ignoreSearch option to cache.delete(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/testharness-helpers.js'); 3 importScripts('/resources/testharness-helpers.js');
4 importScripts('../resources/test-helpers.js'); 4 importScripts('../resources/test-helpers.js');
5 } 5 }
6 6
7 var test_url = 'https://example.com/foo'; 7 var test_url = 'https://example.com/foo';
8 8
9 // Construct a generic Request object. The URL is |test_url|. All other fields 9 // Construct a generic Request object. The URL is |test_url|. All other fields
10 // are defaults. 10 // are defaults.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 cache_test(function(cache) { 58 cache_test(function(cache) {
59 return cache.delete(test_url) 59 return cache.delete(test_url)
60 .then(function(result) { 60 .then(function(result) {
61 assert_false(result, 61 assert_false(result,
62 'Cache.delete should resolve with "false" if there ' + 62 'Cache.delete should resolve with "false" if there ' +
63 'are no matching entries.'); 63 'are no matching entries.');
64 }); 64 });
65 }, 'Cache.delete with a non-existent entry'); 65 }, 'Cache.delete with a non-existent entry');
66 66
67 var cache_entries = { 67 prepopulated_cache_test(simple_entries, function(cache, entries) {
zino 2016/02/16 06:45:44 I'm not sure but these codes looks unnecessary.
nhiroki 2016/02/16 08:47:23 Acknowledged.
68 a: { 68 return cache.matchAll(entries.a_with_query.request,
69 request: new Request('http://example.com/abc'), 69 { ignoreSearch: true })
70 response: new Response('') 70 .then(function(result) {
71 assert_response_array_equivalent(
72 result,
73 [
74 entries.a.response,
75 entries.a_with_query.response
76 ]);
77 return cache.delete(entries.a_with_query.request,
78 { ignoreSearch: true });
nhiroki 2016/02/16 08:47:23 Can you add a test for the case where 'ignoreSearc
zino 2016/02/16 09:23:09 Done.
79 })
80 .then(function(result) {
81 return cache.matchAll(entries.a_with_query.request,
82 { ignoreSearch: true });
83 })
84 .then(function(result) {
85 assert_response_array_equivalent(result, []);
86 });
71 }, 87 },
72 88 'Cache.delete with ignoreSearch option (request with search parameters)');
73 b: {
74 request: new Request('http://example.com/b'),
75 response: new Response('')
76 },
77
78 a_with_query: {
79 request: new Request('http://example.com/abc?q=r'),
80 response: new Response('')
81 }
82 };
83
84 function prepopulated_cache_test(test_function, description) {
zino 2016/02/16 06:45:44 This test doesn't run actually. So, I removed it.
nhiroki 2016/02/16 08:47:23 Acknowledged.
85 cache_test(function(cache) {
86 return Promise.all(Object.keys(cache_entries).map(function(k) {
87 return cache.put(cache_entries[k].request.clone(),
88 cache_entries[k].response.clone());
89 }))
90 .then(function() {
91 return test_function(cache);
92 });
93 }, description);
94 }
95 89
96 done(); 90 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698