summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/indexeddb/script-tests/transaction-basics.js')
-rw-r--r--LayoutTests/storage/indexeddb/script-tests/transaction-basics.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
new file mode 100644
index 0000000..58ac2a7
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
@@ -0,0 +1,47 @@
+description("Test IndexedDB transaction basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeFalse("indexedDB == null");
+
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("createObjectStoreCallback():");
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ deleteAllObjectStores(db);
+
+ result = evalAndLog("db.createObjectStore('storeName', null)");
+ verifyResult(result);
+ result.onsuccess = createSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createSuccess()
+{
+ verifySuccessEvent(event);
+ transaction = evalAndLog("db.transaction()");
+ transaction.onabort = abortCallback;
+ var store = evalAndLog("store = transaction.objectStore('storeName')");
+ shouldBeEqualToString("store.name", "storeName");
+}
+
+function abortCallback()
+{
+ verifyAbortEvent(event);
+ done();
+}
+
+test();
+
+var successfullyParsed = true;