| Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-storage-match.js
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-storage-match.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-storage-match.js
|
| index 21517b1eccddcae9bca4349c282e3d942bdf9a8b..3546520486425e8de27da7b7fc270ce75ad61a7b 100644
|
| --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-storage-match.js
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-storage-match.js
|
| @@ -133,4 +133,110 @@ promise_test(function(test) {
|
| });
|
| }, 'CacheStorageMatch with no caches available but name provided');
|
|
|
| +cache_test(function(cache) {
|
| + var transaction = create_unique_transaction();
|
| +
|
| + return self.caches.delete('')
|
| + .then(function() {
|
| + return self.caches.has('');
|
| + })
|
| + .then(function(has_cache) {
|
| + assert_false(has_cache, "The cache should not exist.");
|
| + return cache.put(transaction.request, transaction.response.clone());
|
| + })
|
| + .then(function() {
|
| + return self.caches.match(transaction.request, {cacheName: ''});
|
| + })
|
| + .then(function(response) {
|
| + assert_equals(response, undefined,
|
| + 'The response should not be found.');
|
| + return self.caches.open('');
|
| + })
|
| + .then(function(cache) {
|
| + return cache.put(transaction.request, transaction.response);
|
| + })
|
| + .then(function() {
|
| + return self.caches.match(transaction.request, {cacheName: ''});
|
| + })
|
| + .then(function(response) {
|
| + assert_response_equals(response, transaction.response,
|
| + 'The response should be matched.');
|
| + return self.caches.delete('');
|
| + });
|
| +}, 'CacheStorageMatch with empty cache name provided');
|
| +
|
| +cache_test(function(cache) {
|
| + var request = new Request('http://example.com/?foo');
|
| + var no_query_request = new Request('http://example.com/');
|
| + var response = new Response('foo');
|
| + return cache.put(request.clone(), response.clone())
|
| + .then(function() {
|
| + return self.caches.match(no_query_request.clone());
|
| + })
|
| + .then(function(result) {
|
| + assert_equals(
|
| + result, undefined,
|
| + 'CacheStorageMatch should resolve as undefined with a ' +
|
| + 'mismatched query.');
|
| + return self.caches.match(no_query_request.clone(),
|
| + {ignoreSearch: true});
|
| + })
|
| + .then(function(result) {
|
| + assert_response_equals(
|
| + result, response,
|
| + 'CacheStorageMatch with ignoreSearch should ignore the ' +
|
| + 'query of the request.');
|
| + });
|
| + }, 'CacheStorageMatch supports ignoreSearch');
|
| +
|
| +cache_test(function(cache) {
|
| + var request = new Request('http://example.com/');
|
| + var head_request = new Request('http://example.com/', {method: 'HEAD'});
|
| + var response = new Response('foo');
|
| + return cache.put(request.clone(), response.clone())
|
| + .then(function() {
|
| + return self.caches.match(head_request.clone());
|
| + })
|
| + .then(function(result) {
|
| + assert_equals(
|
| + result, undefined,
|
| + 'CacheStorageMatch should resolve as undefined with a ' +
|
| + 'mismatched method.');
|
| + return self.caches.match(head_request.clone(),
|
| + {ignoreMethod: true});
|
| + })
|
| + .then(function(result) {
|
| + assert_response_equals(
|
| + result, response,
|
| + 'CacheStorageMatch with ignoreMethod should ignore the ' +
|
| + 'method of request.');
|
| + });
|
| + }, 'Cache.match supports ignoreMethod');
|
| +
|
| +cache_test(function(cache) {
|
| + var vary_request = new Request('http://example.com/c',
|
| + {headers: {'Cookies': 'is-for-cookie'}});
|
| + var vary_response = new Response('', {headers: {'Vary': 'Cookies'}});
|
| + var mismatched_vary_request = new Request('http://example.com/c');
|
| +
|
| + return cache.put(vary_request.clone(), vary_response.clone())
|
| + .then(function() {
|
| + return self.caches.match(mismatched_vary_request.clone());
|
| + })
|
| + .then(function(result) {
|
| + assert_equals(
|
| + result, undefined,
|
| + 'CacheStorageMatch should resolve as undefined with a ' +
|
| + ' mismatched vary.');
|
| + return self.caches.match(mismatched_vary_request.clone(),
|
| + {ignoreVary: true});
|
| + })
|
| + .then(function(result) {
|
| + assert_response_equals(
|
| + result, vary_response,
|
| + 'CacheStorageMatch with ignoreVary should ignore the ' +
|
| + 'vary of request.');
|
| + });
|
| + }, 'CacheStorageMatch supports ignoreVary');
|
| +
|
| done();
|
|
|