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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/resources/testharness-helpers.js

Issue 2084053004: IndexedDB: Defer delete calls when there is a running upgrade (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, made delete lists contain unique_ptrs Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 function indexeddb_test(upgrade_func, body_func, description) { 1 function indexeddb_test(upgrade_func, body_func, description) {
2 async_test(function(t) { 2 async_test(function(t) {
3 var dbName = 'db' + self.location.pathname + '-' + description; 3 var dbName = 'db' + self.location.pathname + '-' + description;
4 var delete_request = indexedDB.deleteDatabase(dbName); 4 var delete_request = indexedDB.deleteDatabase(dbName);
5 delete_request.onerror = t.unreached_func('deleteDatabase should not fai l'); 5 delete_request.onerror = t.unreached_func('deleteDatabase should not fai l');
6 delete_request.onsuccess = t.step_func(function(e) { 6 delete_request.onsuccess = t.step_func(function(e) {
7 var open_request = indexedDB.open(dbName); 7 var open_request = indexedDB.open(dbName);
8 open_request.onerror = t.unreached_func('open should not fail'); 8 open_request.onerror = t.unreached_func('open should not fail');
9 open_request.onupgradeneeded = t.step_func(function(e) { 9 open_request.onupgradeneeded = t.step_func(function(e) {
10 upgrade_func(t, open_request.result); 10 upgrade_func(t, open_request.result);
11 }); 11 });
12 open_request.onsuccess = t.step_func(function(e) { 12 open_request.onsuccess = t.step_func(function(e) {
13 body_func(t, open_request.result); 13 body_func(t, open_request.result);
14 }); 14 });
15 }); 15 });
16 }, description); 16 }, description);
17 } 17 }
18 18
19 function assert_key_equals(a, b, message) { 19 function assert_key_equals(a, b, message) {
20 assert_equals(indexedDB.cmp(a, b), 0, message); 20 assert_equals(indexedDB.cmp(a, b), 0, message);
21 } 21 }
22
23 // Call with a Test and an array of expected results in order. Returns
24 // a function; call the function when a result arrives and when the
25 // expected number appear the order will be asserted and test
26 // completed.
27 function expect(t, expected) {
28 var results = [];
29 return result => {
30 results.push(result);
31 if (results.length === expected.length) {
32 assert_array_equals(results, expected);
33 t.done();
34 }
35 };
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698