Chromium Code Reviews| 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 promise_test(function(t) { | 6 promise_test(function(t) { |
| 7 var cache_name = 'cache-storage/foo'; | 7 var cache_name = 'cache-storage/foo'; |
| 8 return self.caches.delete(cache_name) | 8 return self.caches.delete(cache_name) |
| 9 .then(function() { | 9 .then(function() { |
| 10 return self.caches.open(cache_name); | 10 return self.caches.open(cache_name); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 promise_test(function(t) { | 196 promise_test(function(t) { |
| 197 return self.caches.delete('cheezburger') | 197 return self.caches.delete('cheezburger') |
| 198 .then(function(result) { | 198 .then(function(result) { |
| 199 assert_false(result, | 199 assert_false(result, |
| 200 'CacheStorage.delete should return false for a ' + | 200 'CacheStorage.delete should return false for a ' + |
| 201 'nonexistent cache.'); | 201 'nonexistent cache.'); |
| 202 }); | 202 }); |
| 203 }, 'CacheStorage.delete with nonexistent cache'); | 203 }, 'CacheStorage.delete with nonexistent cache'); |
| 204 | 204 |
| 205 promise_test(function(t) { | 205 promise_test(function(t) { |
| 206 var bad_name = 'unpaired\uD800'; | 206 var bad_name = 'unpaired\uD800'; |
|
jkarlin
2016/11/22 15:08:34
bad_name is very confusing. It makes me think that
jsbell
2016/11/22 18:02:39
Agreed, will do.
| |
| 207 var converted_name = 'unpaired\uFFFD'; // Don't create cache with this name. | 207 var converted_name = 'unpaired\uFFFD'; |
| 208 return self.caches.has(converted_name) | 208 return Promise.all([ |
| 209 self.caches.delete(bad_name), | |
| 210 self.caches.delete(converted_name) | |
|
jkarlin
2016/11/22 15:08:34
How was this issue (not deleting the caches) not c
jsbell
2016/11/22 18:02:39
This test runs 3 times (as window, worker, and ser
jkarlin
2016/11/22 18:05:47
Acknowledged.
| |
| 211 ]) | |
| 212 .then(function() { | |
| 213 return self.caches.has(converted_name); | |
| 214 }) | |
| 209 .then(function(cache_exists) { | 215 .then(function(cache_exists) { |
| 210 assert_false(cache_exists, | 216 assert_false(cache_exists, |
| 211 'Test setup failure: cache should not exist'); | 217 'Test setup failure: cache should not exist'); |
| 212 }) | 218 }) |
| 213 .then(function() { return self.caches.open(bad_name); }) | 219 .then(function() { return self.caches.open(bad_name); }) |
| 214 .then(function() { return self.caches.keys(); }) | 220 .then(function() { return self.caches.keys(); }) |
| 215 .then(function(keys) { | 221 .then(function(keys) { |
| 216 assert_true(keys.indexOf(bad_name) !== -1, | 222 assert_true(keys.indexOf(bad_name) !== -1, |
| 217 'keys should include cache with bad name'); | 223 'keys should include cache with bad name'); |
| 218 }) | 224 }) |
| 219 .then(function() { return self.caches.has(bad_name); }) | 225 .then(function() { return self.caches.has(bad_name); }) |
| 220 .then(function(cache_exists) { | 226 .then(function(cache_exists) { |
| 221 assert_true(cache_exists, | 227 assert_true(cache_exists, |
| 222 'CacheStorage names should be not be converted.'); | 228 'CacheStorage names should be not be converted.'); |
| 223 }) | 229 }) |
| 224 .then(function() { return self.caches.has(converted_name); }) | 230 .then(function() { return self.caches.has(converted_name); }) |
| 225 .then(function(cache_exists) { | 231 .then(function(cache_exists) { |
| 226 assert_false(cache_exists, | 232 assert_false(cache_exists, |
| 227 'CacheStorage names should be not be converted.'); | 233 'CacheStorage names should be not be converted.'); |
| 228 }); | 234 }); |
| 229 }, 'CacheStorage names are DOMStrings not USVStrings'); | 235 }, 'CacheStorage names are DOMStrings not USVStrings'); |
| 230 | 236 |
| 231 done(); | 237 done(); |
| OLD | NEW |