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