OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
3 importScripts('/resources/testharness-helpers.js'); | 3 importScripts('/resources/testharness-helpers.js'); |
4 importScripts('../resources/test-helpers.js'); | 4 importScripts('../resources/test-helpers.js'); |
5 } | 5 } |
6 | 6 |
7 (function() { | 7 (function() { |
8 var next_index = 1; | 8 var next_index = 1; |
9 | 9 |
10 // Returns a transaction (request, response, and url) for a unique URL. | 10 // Returns a transaction (request, response, and url) for a unique URL. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 }, 'CacheStorageMatch with no cached entry'); | 104 }, 'CacheStorageMatch with no cached entry'); |
105 | 105 |
106 promise_test(function(test) { | 106 promise_test(function(test) { |
107 var transaction = create_unique_transaction(); | 107 var transaction = create_unique_transaction(); |
108 return self.caches.has('foo') | 108 return self.caches.has('foo') |
109 .then(function(has_foo) { | 109 .then(function(has_foo) { |
110 assert_false(has_foo, "The cache should not exist."); | 110 assert_false(has_foo, "The cache should not exist."); |
111 return self.caches.match(transaction.request, {cacheName: 'foo'}); | 111 return self.caches.match(transaction.request, {cacheName: 'foo'}); |
112 }) | 112 }) |
113 .then(function(response) { | 113 .then(function(response) { |
114 assert_equals(response, undefined, | 114 assert_unreached('The match with bad cache name should reject.'); |
115 'The response should not be found.'); | 115 }) |
| 116 .catch(function(err) { |
| 117 assert_equals(err.name, 'NotFoundError', |
| 118 'The match should reject with NotFoundError.'); |
116 return self.caches.has('foo'); | 119 return self.caches.has('foo'); |
117 }) | 120 }) |
118 .then(function(has_foo) { | 121 .then(function(has_foo) { |
119 assert_false(has_foo, "The cache should still not exist."); | 122 assert_false(has_foo, "The cache should still not exist."); |
120 }) | 123 }) |
121 }, 'CacheStorageMatch with no caches available but name provided'); | 124 }, 'CacheStorageMatch with no caches available but name provided'); |
122 | 125 |
123 done(); | 126 done(); |
OLD | NEW |