summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/indexeddb/script-tests/basics.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/indexeddb/script-tests/basics.js')
-rw-r--r--LayoutTests/storage/indexeddb/script-tests/basics.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/LayoutTests/storage/indexeddb/script-tests/basics.js b/LayoutTests/storage/indexeddb/script-tests/basics.js
new file mode 100644
index 0000000..307196a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/basics.js
@@ -0,0 +1,61 @@
+description("Test the basics of IndexedDB.");
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+
+function eventShared()
+{
+ debug("");
+ shouldBeTrue("'source' in event");
+ shouldBeTrue("'open' in event.source");
+ debug("");
+ shouldBeTrue("'result' in event");
+ shouldBeFalse("'code' in event");
+ shouldBeFalse("'message' in event");
+ debug("");
+ shouldBeTrue("'onsuccess' in event.target");
+ shouldBeTrue("'onerror' in event.target");
+ shouldBeTrue("'abort' in event.target");
+ shouldBeTrue("'readyState' in event.target");
+ shouldBe("event.target.readyState", "event.target.DONE");
+ debug("");
+ window.successfullyParsed = true;
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+}
+
+function successFunction()
+{
+ debug("Success function called");
+ eventShared();
+}
+
+function errorFunction()
+{
+ testFailed("Error function called: (" + event.code + ") " + event.message);
+ eventShared();
+}
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeTrue("'open' in indexedDB");
+
+ result = evalAndLog("indexedDB.open('name', 'description', true /* allow modification */)");
+ shouldBeTrue("'onsuccess' in result");
+ shouldBeTrue("'onerror' in result");
+ shouldBeTrue("'abort' in result");
+ shouldBeTrue("'readyState' in result");
+ result.onsuccess = successFunction;
+ result.onerror = errorFunction;
+ debug("");
+ debug("An event should fire shortly...");
+ debug("");
+}
+
+test();
+