| OLD | NEW |
| 1 importScripts('worker-testharness.js'); | 1 importScripts('worker-testharness.js'); |
| 2 importScripts('/resources/testharness-helpers.js'); | 2 importScripts('/resources/testharness-helpers.js'); |
| 3 | 3 |
| 4 var test_url = 'https://example.com/foo'; | 4 var test_url = 'https://example.com/foo'; |
| 5 | 5 |
| 6 // Construct a generic Request object. The URL is |test_url|. All other fields | 6 // Construct a generic Request object. The URL is |test_url|. All other fields |
| 7 // are defaults. | 7 // are defaults. |
| 8 function new_test_request() { | 8 function new_test_request() { |
| 9 return new Request(test_url); | 9 return new Request(test_url); |
| 10 } | 10 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // is to test that CacheQueryOptions, if specified, are used. | 120 // is to test that CacheQueryOptions, if specified, are used. |
| 121 | 121 |
| 122 prepopulated_cache_test(function(cache) { | 122 prepopulated_cache_test(function(cache) { |
| 123 return cache.delete('http://example.com/a', { prefixMatch: true }) | 123 return cache.delete('http://example.com/a', { prefixMatch: true }) |
| 124 .then(function(result) { | 124 .then(function(result) { |
| 125 assert_true(result, | 125 assert_true(result, |
| 126 'Cache.delete should resolve with "true" if an entry ' + | 126 'Cache.delete should resolve with "true" if an entry ' + |
| 127 'was successfully deleted.'); | 127 'was successfully deleted.'); |
| 128 }) | 128 }) |
| 129 .then(function() { | 129 .then(function() { |
| 130 return Promise.all([].concat( | 130 return Promise.all( |
| 131 // The entries 'a' and 'a_with_query' should have been deleted. | 131 [].concat( |
| 132 ['a', 'a_with_query'].map(function(k) { | 132 // The entries 'a' and 'a_with_query' should have been deleted. |
| 133 return assert_promise_rejects( | 133 ['a', 'a_with_query'].map(function(k) { |
| 134 cache.match(cache_entries[k].request.url), | 134 return assert_promise_rejects( |
| 135 'NotFoundError', | 135 cache.match(cache_entries[k].request.url), |
| 136 'Cache.delete should respect "prefixMatch" option.'); | 136 'NotFoundError', |
| 137 }), | 137 'Cache.delete should respect "prefixMatch" option.'); |
| 138 // The entry 'b' should still be in the cache. | 138 }), |
| 139 cache.match(cache_entries.b.request.url) | 139 // The entry 'b' should still be in the cache. |
| 140 cache.match(cache_entries.b.request.url) |
| 140 .catch(function() { | 141 .catch(function() { |
| 141 assert_unreached('Cache.delete should respect ' + | 142 assert_unreached('Cache.delete should respect ' + |
| 142 '"prefixMatch" option.'); | 143 '"prefixMatch" option.'); |
| 143 }) | 144 }) |
| 144 )); | 145 )); |
| 145 }); | 146 }); |
| 146 }, 'Cache.delete with CacheQueryOptions.*'); | 147 }, 'Cache.delete with CacheQueryOptions.*'); |
| 147 | 148 |
| 148 prepopulated_cache_test(function(cache) { | 149 prepopulated_cache_test(function(cache) { |
| 149 return cache.delete('http://example.com/ac', { prefixMatch: true }) | 150 return cache.delete('http://example.com/ac', { prefixMatch: true }) |
| 150 .then(function(result) { | 151 .then(function(result) { |
| 151 assert_false(result, | 152 assert_false(result, |
| 152 'Cache.delete should resolve with "false" if there ' + | 153 'Cache.delete should resolve with "false" if there ' + |
| 153 'are no matching entries.'); | 154 'are no matching entries.'); |
| 154 }); | 155 }); |
| 155 }, 'Cache.delete with CacheQueryOptions.* that don\'t match'); | 156 }, 'Cache.delete with CacheQueryOptions.* that don\'t match'); |
| 156 | 157 |
| OLD | NEW |