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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/cachestorage/resources/test-helpers.js

Issue 2520093002: Make Cache Storage tests resilient to execution order (Closed)
Patch Set: Rename string, add comment and helper Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 (function() { 1 (function() {
2 var next_cache_index = 1; 2 var next_cache_index = 1;
3 3
4 // Returns a promise that resolves to a newly created Cache object. The 4 // Returns a promise that resolves to a newly created Cache object. The
5 // returned Cache will be destroyed when |test| completes. 5 // returned Cache will be destroyed when |test| completes.
6 function create_temporary_cache(test) { 6 function create_temporary_cache(test) {
7 var uniquifier = String(++next_cache_index); 7 var uniquifier = String(++next_cache_index);
8 var cache_name = self.location.pathname + '/' + uniquifier; 8 var cache_name = self.location.pathname + '/' + uniquifier;
9 9
10 test.add_cleanup(function() { 10 test.add_cleanup(function() {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 function assert_request_in_array(actual, expected_array, description) { 285 function assert_request_in_array(actual, expected_array, description) {
286 assert_true(expected_array.some(function(element) { 286 assert_true(expected_array.some(function(element) {
287 try { 287 try {
288 assert_request_equals(actual, element); 288 assert_request_equals(actual, element);
289 return true; 289 return true;
290 } catch (e) { 290 } catch (e) {
291 return false; 291 return false;
292 } 292 }
293 }), description); 293 }), description);
294 } 294 }
295
296 // Deletes all caches, returning a promise indicating success.
297 function delete_all_caches() {
298 return self.caches.keys()
299 .then(function(keys) {
300 return Promise.all(keys.map(self.caches.delete.bind(self.caches)));
301 });
302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698