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 f52e741aae6910c49224bf1996fe63956d35964f..60961052a85f4fe3b676fa8959e8a053b29b482d 100644 |
--- a/content/browser/cache_storage/cache_storage_cache_unittest.cc |
+++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc |
@@ -504,12 +504,16 @@ class CacheStorageCacheTest : public testing::Test { |
return error == CACHE_STORAGE_OK; |
} |
- bool Keys() { |
+ bool Keys( |
+ const ServiceWorkerFetchRequest& request = ServiceWorkerFetchRequest(), |
+ const CacheStorageCacheQueryParams& match_params = |
+ CacheStorageCacheQueryParams()) { |
std::unique_ptr<base::RunLoop> loop(new base::RunLoop()); |
- cache_->Keys(base::Bind(&CacheStorageCacheTest::RequestsCallback, |
- base::Unretained(this), |
- base::Unretained(loop.get()))); |
+ cache_->Keys( |
+ CopyFetchRequest(request), match_params, |
+ base::Bind(&CacheStorageCacheTest::RequestsCallback, |
+ base::Unretained(this), base::Unretained(loop.get()))); |
loop->Run(); |
return callback_error_ == CACHE_STORAGE_OK; |
@@ -1038,6 +1042,39 @@ TEST_P(CacheStorageCacheTestP, TwoKeysThenOne) { |
EXPECT_TRUE(VerifyKeys(expected_key)); |
} |
+TEST_P(CacheStorageCacheTestP, KeysWithIgnoreSearchTrue) { |
+ EXPECT_TRUE(Put(no_body_request_, no_body_response_)); |
+ EXPECT_TRUE(Put(body_request_, body_response_)); |
+ EXPECT_TRUE(Put(body_request_with_query_, body_response_with_query_)); |
+ |
+ CacheStorageCacheQueryParams match_params; |
+ match_params.ignore_search = true; |
+ |
+ EXPECT_TRUE(Keys(body_request_with_query_, match_params)); |
+ EXPECT_EQ(2u, callback_strings_.size()); |
+ std::vector<std::string> expected_keys = { |
+ body_request_.url.spec(), body_request_with_query_.url.spec()}; |
+ EXPECT_TRUE(VerifyKeys(expected_keys)); |
+} |
+ |
+TEST_P(CacheStorageCacheTestP, KeysWithIgnoreSearchFalse) { |
+ EXPECT_TRUE(Put(no_body_request_, no_body_response_)); |
+ EXPECT_TRUE(Put(body_request_, body_response_)); |
+ EXPECT_TRUE(Put(body_request_with_query_, body_response_with_query_)); |
+ |
+ // Default value of ignore_search is false. |
+ CacheStorageCacheQueryParams match_params; |
+ match_params.ignore_search = false; |
+ EXPECT_EQ(match_params.ignore_search, |
+ CacheStorageCacheQueryParams().ignore_search); |
+ |
+ EXPECT_TRUE(Keys(body_request_with_query_, match_params)); |
+ EXPECT_EQ(1u, callback_strings_.size()); |
+ std::vector<std::string> expected_keys = { |
+ body_request_with_query_.url.spec()}; |
+ EXPECT_TRUE(VerifyKeys(expected_keys)); |
+} |
+ |
TEST_P(CacheStorageCacheTestP, DeleteNoBody) { |
EXPECT_TRUE(Put(no_body_request_, no_body_response_)); |
EXPECT_TRUE(Match(no_body_request_)); |