Index: content/browser/cache_storage/cache_storage_cache_unittest.cc |
diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc |
index 363281adda339882a77fb5d17e982fb562435e7f..8074370dda791841e545805ab2554c5d6188a568 100644 |
--- a/content/browser/cache_storage/cache_storage_cache_unittest.cc |
+++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc |
@@ -408,10 +408,13 @@ class CacheStorageCacheTest : public testing::Test { |
responses, body_handles); |
} |
- bool Delete(const ServiceWorkerFetchRequest& request) { |
+ bool Delete(const ServiceWorkerFetchRequest& request, |
+ const CacheStorageCacheQueryParams& match_params = |
+ CacheStorageCacheQueryParams()) { |
jkarlin
2016/02/24 16:35:34
I see that default arguments are now allowed by th
|
CacheStorageBatchOperation operation; |
operation.operation_type = CACHE_STORAGE_CACHE_OPERATION_TYPE_DELETE; |
operation.request = request; |
+ operation.match_params = match_params; |
CacheStorageError error = |
BatchOperation(std::vector<CacheStorageBatchOperation>(1, operation)); |
@@ -1036,6 +1039,26 @@ TEST_P(CacheStorageCacheTestP, Size) { |
EXPECT_EQ(0, Size()); |
} |
+TEST_P(CacheStorageCacheTestP, DeleteWithIgnoreSearch) { |
+ EXPECT_EQ(0, Size()); |
+ EXPECT_TRUE(Put(no_body_request_, no_body_response_)); |
+ EXPECT_LT(0, Size()); |
jkarlin
2016/02/24 16:35:34
Prefer to use Keys() instead of Size() in this tes
zino
2016/02/24 18:05:21
Done.
|
+ int64_t no_body_size = Size(); |
+ |
+ EXPECT_TRUE(Put(body_request_, body_response_)); |
+ EXPECT_TRUE(Put(body_request_with_query_, body_response_with_query_)); |
+ EXPECT_LT(no_body_size, Size()); |
+ |
+ CacheStorageCacheQueryParams match_params; |
+ match_params.ignore_search = true; |
+ |
+ // The following delete operation will remove both of body_reqeust_ and |
jkarlin
2016/02/24 16:35:34
typo: s/body_reqeust_/body_request_/
zino
2016/02/24 18:05:21
Nice catch!
Thank you.
Done.
|
+ // body_request_with_query_ from cache storage. |
+ EXPECT_TRUE(Delete(body_request_with_query_, match_params)); |
+ |
+ EXPECT_EQ(no_body_size, Size()); |
+} |
jkarlin
2016/02/24 16:35:34
Add a second test that deletes with default option
zino
2016/02/24 18:05:21
Done.
|
+ |
TEST_P(CacheStorageCacheTestP, OpsFailOnClosedBackendNeverCreated) { |
cache_->set_delay_backend_creation( |
true); // Will hang the test if a backend is created. |