diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-16 09:59:13 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-20 10:28:53 +0000 |
commit | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch) | |
tree | c8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc | |
parent | 3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff) | |
download | qtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz |
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc b/chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc index 7a1586286a1..e5d9be86a76 100644 --- a/chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc +++ b/chromium/third_party/blink/renderer/modules/cache_storage/cache_test.cc @@ -117,7 +117,7 @@ class ErrorCacheForTests : public mojom::blink::CacheStorageCache { ErrorCacheForTests(const mojom::blink::CacheStorageError error) : error_(error), expected_url_(nullptr), - expected_query_params_(nullptr), + expected_query_options_(nullptr), expected_batch_operations_(nullptr) {} std::string GetAndClearLastErrorWebCacheMethodCalled() { @@ -132,9 +132,9 @@ class ErrorCacheForTests : public mojom::blink::CacheStorageCache { void SetExpectedUrl(const String* expected_url) { expected_url_ = expected_url; } - void SetExpectedQueryParams( - const mojom::blink::QueryParamsPtr* expected_query_params) { - expected_query_params_ = expected_query_params; + void SetExpectedCacheQueryOptions( + const mojom::blink::CacheQueryOptionsPtr* expected_query_options) { + expected_query_options_ = expected_query_options; } void SetExpectedBatchOperations(const Vector<mojom::blink::BatchOperationPtr>* expected_batch_operations) { @@ -142,34 +142,34 @@ class ErrorCacheForTests : public mojom::blink::CacheStorageCache { } void Match(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, MatchCallback callback) override { last_error_web_cache_method_called_ = "dispatchMatch"; CheckUrlIfProvided(fetch_api_request->url); - CheckQueryParamsIfProvided(query_params); + CheckCacheQueryOptionsIfProvided(query_options); mojom::blink::MatchResultPtr result = mojom::blink::MatchResult::New(); result->set_status(error_); std::move(callback).Run(std::move(result)); } void MatchAll(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, MatchAllCallback callback) override { last_error_web_cache_method_called_ = "dispatchMatchAll"; if (fetch_api_request) CheckUrlIfProvided(fetch_api_request->url); - CheckQueryParamsIfProvided(query_params); + CheckCacheQueryOptionsIfProvided(query_options); mojom::blink::MatchAllResultPtr result = mojom::blink::MatchAllResult::New(); result->set_status(error_); std::move(callback).Run(std::move(result)); } void Keys(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, KeysCallback callback) override { last_error_web_cache_method_called_ = "dispatchKeys"; if (fetch_api_request && !fetch_api_request->url.IsEmpty()) { CheckUrlIfProvided(fetch_api_request->url); - CheckQueryParamsIfProvided(query_params); + CheckCacheQueryOptionsIfProvided(query_options); } mojom::blink::CacheKeysResultPtr result = mojom::blink::CacheKeysResult::New(); @@ -198,11 +198,11 @@ class ErrorCacheForTests : public mojom::blink::CacheStorageCache { EXPECT_EQ(*expected_url_, url); } - void CheckQueryParamsIfProvided( - const mojom::blink::QueryParamsPtr& query_params) { - if (!expected_query_params_) + void CheckCacheQueryOptionsIfProvided( + const mojom::blink::CacheQueryOptionsPtr& query_options) { + if (!expected_query_options_) return; - CompareQueryParamsForTest(*expected_query_params_, query_params); + CompareCacheQueryOptionsForTest(*expected_query_options_, query_options); } void CheckBatchOperationsIfProvided( @@ -229,30 +229,30 @@ class ErrorCacheForTests : public mojom::blink::CacheStorageCache { batch_operations[i]->response->url_list[j]); } } - if (expected_batch_operations[i]->match_params || - batch_operations[i]->match_params) { - CompareQueryParamsForTest(expected_batch_operations[i]->match_params, - batch_operations[i]->match_params); + if (expected_batch_operations[i]->match_options || + batch_operations[i]->match_options) { + CompareCacheQueryOptionsForTest( + expected_batch_operations[i]->match_options, + batch_operations[i]->match_options); } } } private: - static void CompareQueryParamsForTest( - const mojom::blink::QueryParamsPtr& expected_query_params, - const mojom::blink::QueryParamsPtr& query_params) { - EXPECT_EQ(expected_query_params->ignore_search, - query_params->ignore_search); - EXPECT_EQ(expected_query_params->ignore_method, - query_params->ignore_method); - EXPECT_EQ(expected_query_params->ignore_vary, query_params->ignore_vary); - EXPECT_EQ(expected_query_params->cache_name, query_params->cache_name); + static void CompareCacheQueryOptionsForTest( + const mojom::blink::CacheQueryOptionsPtr& expected_query_options, + const mojom::blink::CacheQueryOptionsPtr& query_options) { + EXPECT_EQ(expected_query_options->ignore_search, + query_options->ignore_search); + EXPECT_EQ(expected_query_options->ignore_method, + query_options->ignore_method); + EXPECT_EQ(expected_query_options->ignore_vary, query_options->ignore_vary); } const mojom::blink::CacheStorageError error_; const String* expected_url_; - const mojom::blink::QueryParamsPtr* expected_query_params_; + const mojom::blink::CacheQueryOptionsPtr* expected_query_options_; const Vector<mojom::blink::BatchOperationPtr>* expected_batch_operations_; std::string last_error_web_cache_method_called_; @@ -445,15 +445,13 @@ TEST_F(CacheStorageTest, BasicArguments) { const String url = "http://www.cache.arguments.test/"; test_cache()->SetExpectedUrl(&url); - mojom::blink::QueryParamsPtr expected_query_params = - mojom::blink::QueryParams::New(); - expected_query_params->ignore_vary = true; - expected_query_params->cache_name = "this is a cache name"; - test_cache()->SetExpectedQueryParams(&expected_query_params); + mojom::blink::CacheQueryOptionsPtr expected_query_options = + mojom::blink::CacheQueryOptions::New(); + expected_query_options->ignore_vary = true; + test_cache()->SetExpectedCacheQueryOptions(&expected_query_options); CacheQueryOptions* options = CacheQueryOptions::Create(); options->setIgnoreVary(1); - options->setCacheName(expected_query_params->cache_name); Request* request = NewRequestFromUrl(url); DCHECK(request); @@ -516,13 +514,11 @@ TEST_F(CacheStorageTest, BatchOperationArguments) { CreateCache(fetcher, std::make_unique<NotImplementedErrorCache>()); DCHECK(cache); - mojom::blink::QueryParamsPtr expected_query_params = - mojom::blink::QueryParams::New(); - expected_query_params->cache_name = "this is another cache name"; - test_cache()->SetExpectedQueryParams(&expected_query_params); + mojom::blink::CacheQueryOptionsPtr expected_query_options = + mojom::blink::CacheQueryOptions::New(); + test_cache()->SetExpectedCacheQueryOptions(&expected_query_options); CacheQueryOptions* options = CacheQueryOptions::Create(); - options->setCacheName(expected_query_params->cache_name); const String url = "http://batch.operations.test/"; Request* request = NewRequestFromUrl(url); @@ -540,7 +536,7 @@ TEST_F(CacheStorageTest, BatchOperationArguments) { auto& delete_operation = expected_delete_operations.back(); delete_operation->operation_type = mojom::blink::OperationType::kDelete; delete_operation->request = request->CreateFetchAPIRequest(); - delete_operation->match_params = expected_query_params->Clone(); + delete_operation->match_options = expected_query_options->Clone(); } test_cache()->SetExpectedBatchOperations(&expected_delete_operations); @@ -592,7 +588,7 @@ class MatchTestCache : public NotImplementedErrorCache { // From WebServiceWorkerCache: void Match(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, MatchCallback callback) override { mojom::blink::MatchResultPtr result = mojom::blink::MatchResult::New(); result->set_response(std::move(response_)); @@ -637,7 +633,7 @@ class KeysTestCache : public NotImplementedErrorCache { : requests_(std::move(requests)) {} void Keys(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, KeysCallback callback) override { mojom::blink::CacheKeysResultPtr result = mojom::blink::CacheKeysResult::New(); @@ -693,7 +689,7 @@ class MatchAllAndBatchTestCache : public NotImplementedErrorCache { : responses_(std::move(responses)) {} void MatchAll(mojom::blink::FetchAPIRequestPtr fetch_api_request, - mojom::blink::QueryParamsPtr query_params, + mojom::blink::CacheQueryOptionsPtr query_options, MatchAllCallback callback) override { mojom::blink::MatchAllResultPtr result = mojom::blink::MatchAllResult::New(); |