| 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 505f9bd827887ed5da21340bed62fce76e6fff9d..a156595c91feae4b76e1fcbe2cf696a8587dc74f 100644
|
| --- a/content/browser/cache_storage/cache_storage_cache_unittest.cc
|
| +++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc
|
| @@ -388,6 +388,14 @@ class CacheStorageCacheTest : public testing::Test {
|
| return callback_error_ == CACHE_STORAGE_OK;
|
| }
|
|
|
| + bool QueryCache(const ServiceWorkerFetchRequest& request,
|
| + const CacheStorageCacheQueryParams& options) {
|
| + base::RunLoop loop;
|
| + cache_->QueryCache(CopyFetchRequest(request), options);
|
| + loop.Run();
|
| + return true;
|
| + }
|
| +
|
| bool MatchAll(const ServiceWorkerFetchRequest& request,
|
| const CacheStorageCacheQueryParams& match_params,
|
| scoped_ptr<CacheStorageCache::Responses>* responses,
|
| @@ -829,6 +837,38 @@ TEST_P(CacheStorageCacheTestP, MatchAll_IgnoreSearch) {
|
| EXPECT_EQ(2u, matched_set.size());
|
| }
|
|
|
| +TEST_P(CacheStorageCacheTestP, QueryCache) {
|
| + EXPECT_TRUE(Put(body_request_, body_response_));
|
| + EXPECT_TRUE(Put(body_request_with_query_, body_response_with_query_));
|
| + EXPECT_TRUE(Put(no_body_request_, no_body_response_));
|
| +
|
| + CacheStorageCacheQueryParams match_params;
|
| + EXPECT_TRUE(QueryCache(body_request_, match_params));
|
| +
|
| +/* scoped_ptr<CacheStorageCache::Responses> responses;
|
| + scoped_ptr<CacheStorageCache::BlobDataHandles> body_handles;
|
| + CacheStorageCacheQueryParams match_params;
|
| + match_params.ignore_search = true;
|
| + EXPECT_TRUE(MatchAll(body_request_, match_params, &responses, &body_handles));
|
| +
|
| + ASSERT_EQ(2u, responses->size());
|
| + ASSERT_EQ(2u, body_handles->size());
|
| +
|
| + // Order of returned responses is not guaranteed.
|
| + std::set<std::string> matched_set;
|
| + for (const ServiceWorkerResponse& response : *responses) {
|
| + if (response.url.spec() == "http://example.com/body.html?query=test") {
|
| + EXPECT_TRUE(ResponseMetadataEqual(body_response_with_query_, response));
|
| + matched_set.insert(response.url.spec());
|
| + } else if (response.url.spec() == "http://example.com/body.html") {
|
| + EXPECT_TRUE(ResponseMetadataEqual(body_response_, response));
|
| + matched_set.insert(response.url.spec());
|
| + }
|
| + }
|
| + EXPECT_EQ(2u, matched_set.size());*/
|
| +}
|
| +
|
| +
|
| TEST_P(CacheStorageCacheTestP, Vary) {
|
| body_request_.headers["vary_foo"] = "foo";
|
| body_response_.headers["vary"] = "vary_foo";
|
|
|