Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js |
index 6bc3a8685726d97d492cc41e97a657949820949d..050ac0b542455ceb53ed36038af5b9b0810977cf 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js |
@@ -141,23 +141,26 @@ var vary_entries = [ |
// Run |test_function| with a Cache object and a map of entries. Prior to the |
// call, the Cache is populated by cache entries from |entries|. The latter is |
// expected to be an Object mapping arbitrary keys to objects of the form |
-// {request: <Request object>, response: <Response object>}. There's no |
-// guarantee on the order in which entries will be added to the cache. |
+// {request: <Request object>, response: <Response object>}. Entries are |
+// serially added to the cache in the order specified. |
// |
// |test_function| should return a Promise that can be used with promise_test. |
function prepopulated_cache_test(entries, test_function, description) { |
cache_test(function(cache) { |
var p = Promise.resolve(); |
var hash = {}; |
- return Promise.all(entries.map(function(entry) { |
+ entries.forEach(function(entry) { |
hash[entry.name] = entry; |
- return cache.put(entry.request.clone(), |
- entry.response.clone()) |
- .catch(function(e) { |
- assert_unreached( |
- 'Test setup failed for entry ' + entry.name + ': ' + e); |
- }); |
- })) |
+ p = p.then(function() { |
+ return cache.put(entry.request.clone(), entry.response.clone()) |
+ .catch(function(e) { |
+ assert_unreached( |
+ 'Test setup failed for entry ' + entry.name + ': ' + e |
+ ); |
+ }); |
+ }); |
+ }); |
+ return p |
.then(function() { |
assert_equals(Object.keys(hash).length, entries.length); |
}) |