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..2671103c301d8bf37d2c31a9189aa299b5b3d26e 100644 |
--- a/content/browser/cache_storage/cache_storage_cache_unittest.cc |
+++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc |
@@ -384,6 +384,9 @@ class CacheStorageCacheTest : public testing::Test { |
no_body_request_ = |
ServiceWorkerFetchRequest(GURL("http://example.com/no_body.html"), |
"GET", headers, Referrer(), false); |
+ body_head_request_ = |
+ ServiceWorkerFetchRequest(GURL("http://example.com/body.html"), "HEAD", |
+ headers, Referrer(), false); |
std::string expected_response; |
for (int i = 0; i < 100; ++i) |
@@ -688,6 +691,7 @@ class CacheStorageCacheTest : public testing::Test { |
ServiceWorkerResponse body_response_with_query_; |
ServiceWorkerFetchRequest no_body_request_; |
ServiceWorkerResponse no_body_response_; |
+ ServiceWorkerFetchRequest body_head_request_; |
std::unique_ptr<storage::BlobDataHandle> blob_handle_; |
std::string expected_blob_data_; |
@@ -801,7 +805,7 @@ TEST_P(CacheStorageCacheTestP, PutReplace) { |
EXPECT_FALSE(callback_response_data_); |
} |
-TEST_P(CacheStorageCacheTestP, PutReplcaceInBatch) { |
+TEST_P(CacheStorageCacheTestP, PutReplaceInBatch) { |
CacheStorageBatchOperation operation1; |
operation1.operation_type = CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT; |
operation1.request = body_request_; |
@@ -840,6 +844,11 @@ TEST_P(CacheStorageCacheTestP, MatchBody) { |
ResponseBodiesEqual(expected_blob_data_, *callback_response_data_)); |
} |
+TEST_P(CacheStorageCacheTestP, MatchBodyHead) { |
+ EXPECT_TRUE(Put(body_request_, body_response_)); |
+ EXPECT_FALSE(Match(body_head_request_)); |
+} |
+ |
TEST_P(CacheStorageCacheTestP, MatchAll_Empty) { |
std::unique_ptr<CacheStorageCache::Responses> responses; |
std::unique_ptr<CacheStorageCache::BlobDataHandles> body_handles; |
@@ -944,6 +953,22 @@ TEST_P(CacheStorageCacheTestP, MatchAll_IgnoreSearch) { |
EXPECT_EQ(2u, matched_set.size()); |
} |
+TEST_P(CacheStorageCacheTestP, MatchAll_HEAD) { |
+ EXPECT_TRUE(Put(body_request_, body_response_)); |
+ |
+ std::unique_ptr<CacheStorageCache::Responses> responses; |
+ std::unique_ptr<CacheStorageCache::BlobDataHandles> body_handles; |
+ CacheStorageCacheQueryParams match_params; |
+ match_params.ignore_search = true; |
+ EXPECT_TRUE( |
+ MatchAll(body_head_request_, match_params, &responses, &body_handles)); |
+ EXPECT_TRUE(responses->empty()); |
+ EXPECT_TRUE(body_handles->empty()); |
+ |
+ // TODO(jsbell): Test with ignore_method = true when supported. |
jkarlin
2016/08/10 13:22:45
It looks like it's supported to me, at least on th
jsbell
2016/08/10 17:18:09
Done.
|
+ // https://crbug.com/426309 |
+} |
+ |
TEST_P(CacheStorageCacheTestP, Vary) { |
body_request_.headers["vary_foo"] = "foo"; |
body_response_.headers["vary"] = "vary_foo"; |