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

Unified 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: Remove unnecessary check 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-delete.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-delete.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-delete.js
index 5bdc782c6bfa2e3d4d1bc25732dd60151ea08864..0a44029e7b98c21ea4f1bb0446cd1fb804290e9a 100644
--- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-delete.js
+++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-delete.js
@@ -64,33 +64,52 @@ cache_test(function(cache) {
});
}, 'Cache.delete with a non-existent entry');
-var cache_entries = {
- a: {
- request: new Request('http://example.com/abc'),
- response: new Response('')
+prepopulated_cache_test(simple_entries, function(cache, entries) {
+ return cache.matchAll(entries.a_with_query.request,
+ { ignoreSearch: true })
+ .then(function(result) {
+ assert_response_array_equivalent(
+ result,
+ [
+ entries.a.response,
+ entries.a_with_query.response
+ ]);
+ return cache.delete(entries.a_with_query.request,
+ { ignoreSearch: true });
+ })
+ .then(function(result) {
+ return cache.matchAll(entries.a_with_query.request,
+ { ignoreSearch: true });
+ })
+ .then(function(result) {
+ assert_response_array_equivalent(result, []);
+ });
},
+ 'Cache.delete with ignoreSearch option (request with search parameters)');
- b: {
- request: new Request('http://example.com/b'),
- response: new Response('')
+prepopulated_cache_test(simple_entries, function(cache, entries) {
+ return cache.matchAll(entries.a_with_query.request,
+ { ignoreSearch: true })
+ .then(function(result) {
+ assert_response_array_equivalent(
+ result,
+ [
+ entries.a.response,
+ entries.a_with_query.response
+ ]);
+ // cache.delete()'s behavior should be the same if ignoreSearch is
+ // not provided or if ignoreSearch is false.
+ return cache.delete(entries.a_with_query.request,
+ { ignoreSearch: false });
+ })
+ .then(function(result) {
+ return cache.matchAll(entries.a_with_query.request,
+ { ignoreSearch: true });
+ })
+ .then(function(result) {
+ assert_response_array_equivalent(result, [ entries.a.response ]);
+ });
},
-
- a_with_query: {
- request: new Request('http://example.com/abc?q=r'),
- response: new Response('')
- }
-};
-
-function prepopulated_cache_test(test_function, description) {
- cache_test(function(cache) {
- return Promise.all(Object.keys(cache_entries).map(function(k) {
- return cache.put(cache_entries[k].request.clone(),
- cache_entries[k].response.clone());
- }))
- .then(function() {
- return test_function(cache);
- });
- }, description);
-}
+ 'Cache.delete with ignoreSearch option (when it is specified as false)');
done();

Powered by Google App Engine
This is Rietveld 408576698