Index: LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
diff --git a/LayoutTests/storage/indexeddb/resources/testharness-helpers.js b/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9e8892d6706ed14cef434ba7545eb256f9ff84e8 |
--- /dev/null |
+++ b/LayoutTests/storage/indexeddb/resources/testharness-helpers.js |
@@ -0,0 +1,21 @@ |
+function idb_test(description, onUpgrade, onOpen) { |
+ async_test(function(t) { |
+ var dbName = 'db' + location.pathname + '-' + description; |
+ var deleteRequest = indexedDB.deleteDatabase(dbName); |
+ deleteRequest.onerror = t.unreached_func('deleteDatabase should not fail'); |
+ deleteRequest.onsuccess = t.step_func(function(e) { |
+ var openRequest = indexedDB.open(dbName); |
+ openRequest.onerror = t.unreached_func('open should not fail'); |
+ openRequest.onupgradeneeded = t.step_func(function(e) { |
+ onUpgrade(t, openRequest.result); |
+ }); |
+ openRequest.onsuccess = t.step_func(function(e) { |
+ onOpen(t, openRequest.result); |
+ }); |
+ }); |
+ }, description); |
+} |
+ |
+function assert_key_equals(a, b, message) { |
+ assert_equals(indexedDB.cmp(a, b), 0, message); |
cmumford
2015/04/27 17:14:23
expected is first argument.
|
+} |