Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage.js |
| index 673cf50f01ca85146983862c9de6bb81967c6002..dd5e39d91e124c9df59bd41d123d81868019a28b 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-storage.js |
| @@ -203,20 +203,28 @@ promise_test(function(t) { |
| }, 'CacheStorage.delete with nonexistent cache'); |
| promise_test(function(t) { |
| - var bad_name = 'unpaired\uD800'; |
| - var converted_name = 'unpaired\uFFFD'; // Don't create cache with this name. |
| - return self.caches.has(converted_name) |
| + var unpaired_name = 'unpaired\uD800'; |
| + var converted_name = 'unpaired\uFFFD'; |
| + |
| + // The test assumes that a cache with converted_name does not |
| + // exist, but if the implementation fails the test then such |
| + // a cache will be created. Start off in a fresh state by |
| + // deleting all caches. |
| + return delete_all_caches() |
|
jkarlin
2016/11/22 18:20:40
Why not have promise_test run delete_all_caches at
jsbell
2016/11/22 18:34:14
promise_test is generic (part of testharness.js);
|
| + .then(function() { |
| + return self.caches.has(converted_name); |
| + }) |
| .then(function(cache_exists) { |
| assert_false(cache_exists, |
| 'Test setup failure: cache should not exist'); |
| }) |
| - .then(function() { return self.caches.open(bad_name); }) |
| + .then(function() { return self.caches.open(unpaired_name); }) |
| .then(function() { return self.caches.keys(); }) |
| .then(function(keys) { |
| - assert_true(keys.indexOf(bad_name) !== -1, |
| + assert_true(keys.indexOf(unpaired_name) !== -1, |
| 'keys should include cache with bad name'); |
| }) |
| - .then(function() { return self.caches.has(bad_name); }) |
| + .then(function() { return self.caches.has(unpaired_name); }) |
| .then(function(cache_exists) { |
| assert_true(cache_exists, |
| 'CacheStorage names should be not be converted.'); |