Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-storage.js |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-storage.js b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-storage.js |
index 594b01b5810cd8048550ac0567f924d695465b40..521d3bbc25dfd1f5c56be48485dbfa226f0ed9f7 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-storage.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/script-tests/cache-storage.js |
@@ -1,6 +1,5 @@ |
if (self.importScripts) { |
importScripts('/resources/testharness.js'); |
- importScripts('../resources/testharness-helpers.js'); |
importScripts('../resources/test-helpers.js'); |
} |
@@ -31,9 +30,10 @@ promise_test(function(t) { |
}, 'CacheStorage.open with an empty name'); |
promise_test(function(t) { |
- return assert_promise_rejects( |
- self.caches.open(), |
+ return promise_rejects( |
+ t, |
new TypeError(), |
+ self.caches.open(), |
'CacheStorage.open should throw TypeError if called with no arguments.'); |
}, 'CacheStorage.open with no arguments'); |
@@ -169,20 +169,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() |
+ .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.'); |