Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js

Issue 2806793002: Cache API tests: prepopulate cache in deterministic order (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
})
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698