Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / testharness-helpers.js
blobceec0aa8a901397daa568aea6dfbadf31515360e
1 function indexeddb_test(upgrade_func, body_func, description) {
2     async_test(function(t) {
3         var dbName = 'db' + self.location.pathname + '-' + description;
4         var delete_request = indexedDB.deleteDatabase(dbName);
5         delete_request.onerror = t.unreached_func('deleteDatabase should not fail');
6         delete_request.onsuccess = t.step_func(function(e) {
7             var open_request = indexedDB.open(dbName);
8             open_request.onerror = t.unreached_func('open should not fail');
9             open_request.onupgradeneeded = t.step_func(function(e) {
10                 upgrade_func(t, open_request.result);
11             });
12             open_request.onsuccess = t.step_func(function(e) {
13                 body_func(t, open_request.result);
14             });
15         });
16     }, description);
19 function assert_key_equals(a, b, message) {
20     assert_equals(indexedDB.cmp(a, b), 0, message);