summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage')
-rw-r--r--LayoutTests/storage/indexeddb/idb-database-request-expected.txt2
-rw-r--r--LayoutTests/storage/indexeddb/idb-keyrange-expected.txt119
-rw-r--r--LayoutTests/storage/indexeddb/idb-keyrange.html13
-rw-r--r--LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt49
-rw-r--r--LayoutTests/storage/indexeddb/idb-objectstore-request.html13
-rw-r--r--LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js75
-rw-r--r--LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js42
7 files changed, 312 insertions, 1 deletions
diff --git a/LayoutTests/storage/indexeddb/idb-database-request-expected.txt b/LayoutTests/storage/indexeddb/idb-database-request-expected.txt
index 70ec252..2651dd8 100644
--- a/LayoutTests/storage/indexeddb/idb-database-request-expected.txt
+++ b/LayoutTests/storage/indexeddb/idb-database-request-expected.txt
@@ -24,7 +24,7 @@ PASS event.target.readyState is event.target.DONE
db = event.result
PASS db.name is "name"
-FAIL db.description should be description (of type string). Was undefined (of type undefined).
+PASS db.description is "description"
PASS db.version is ""
PASS db.objectStores is []
PASS db.objectStores.length is 0
diff --git a/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt b/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt
new file mode 100644
index 0000000..316a97b
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/idb-keyrange-expected.txt
@@ -0,0 +1,119 @@
+Test IndexedDB's KeyRange.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB.makeSingleKeyRange(1)
+PASS keyRange.left is 1
+PASS keyRange.right is 1
+PASS keyRange.flags is keyRange.SINGLE
+indexedDB.makeSingleKeyRange('a')
+PASS keyRange.left is 'a'
+PASS keyRange.right is 'a'
+PASS keyRange.flags is keyRange.SINGLE
+indexedDB.makeLeftBoundKeyRange(10,true)
+PASS keyRange.left is 10
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_OPEN
+indexedDB.makeLeftBoundKeyRange(11,false)
+PASS keyRange.left is 11
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_BOUND
+indexedDB.makeLeftBoundKeyRange(12,undefined)
+PASS keyRange.left is 12
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_BOUND
+indexedDB.makeLeftBoundKeyRange('aa',true)
+PASS keyRange.left is 'aa'
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_OPEN
+indexedDB.makeLeftBoundKeyRange('ab',false)
+PASS keyRange.left is 'ab'
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_BOUND
+indexedDB.makeLeftBoundKeyRange('ac',undefined)
+PASS keyRange.left is 'ac'
+PASS keyRange.right is null
+PASS keyRange.flags is keyRange.LEFT_BOUND
+indexedDB.makeRightBoundKeyRange(20,true)
+PASS keyRange.right is 20
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_OPEN
+indexedDB.makeRightBoundKeyRange(21,false)
+PASS keyRange.right is 21
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_BOUND
+indexedDB.makeRightBoundKeyRange(22,undefined)
+PASS keyRange.right is 22
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_BOUND
+indexedDB.makeRightBoundKeyRange('ba',true)
+PASS keyRange.right is 'ba'
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_OPEN
+indexedDB.makeRightBoundKeyRange('bb',false)
+PASS keyRange.right is 'bb'
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_BOUND
+indexedDB.makeRightBoundKeyRange('bc',undefined)
+PASS keyRange.right is 'bc'
+PASS keyRange.left is null
+PASS keyRange.flags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange(30,40,undefined,undefined)
+PASS keyRange.left is 30
+PASS keyRange.right is 40
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange(31,41,false,false)
+PASS keyRange.left is 31
+PASS keyRange.right is 41
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange(32,42,false,true)
+PASS keyRange.left is 32
+PASS keyRange.right is 42
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_OPEN
+indexedDB.makeBoundKeyRange(33,43,true,false)
+PASS keyRange.left is 33
+PASS keyRange.right is 43
+PASS leftFlags is keyRange.LEFT_OPEN
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange(34,44,true,true)
+PASS keyRange.left is 34
+PASS keyRange.right is 44
+PASS leftFlags is keyRange.LEFT_OPEN
+PASS rightFlags is keyRange.RIGHT_OPEN
+indexedDB.makeBoundKeyRange('aaa','aba',false,false)
+PASS keyRange.left is 'aaa'
+PASS keyRange.right is 'aba'
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange('aab','abb',undefined,undefined)
+PASS keyRange.left is 'aab'
+PASS keyRange.right is 'abb'
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange('aac','abc',false,false)
+PASS keyRange.left is 'aac'
+PASS keyRange.right is 'abc'
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange('aad','abd',false,true)
+PASS keyRange.left is 'aad'
+PASS keyRange.right is 'abd'
+PASS leftFlags is keyRange.LEFT_BOUND
+PASS rightFlags is keyRange.RIGHT_OPEN
+indexedDB.makeBoundKeyRange('aae','abe',true,false)
+PASS keyRange.left is 'aae'
+PASS keyRange.right is 'abe'
+PASS leftFlags is keyRange.LEFT_OPEN
+PASS rightFlags is keyRange.RIGHT_BOUND
+indexedDB.makeBoundKeyRange('aaf','abf',true,true)
+PASS keyRange.left is 'aaf'
+PASS keyRange.right is 'abf'
+PASS leftFlags is keyRange.LEFT_OPEN
+PASS rightFlags is keyRange.RIGHT_OPEN
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/idb-keyrange.html b/LayoutTests/storage/indexeddb/idb-keyrange.html
new file mode 100644
index 0000000..800a8cc
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/idb-keyrange.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/idb-keyrange.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt b/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt
new file mode 100644
index 0000000..bcf1d63
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/idb-objectstore-request-expected.txt
@@ -0,0 +1,49 @@
+Test IndexedDB's IDBObjectStoreRequest.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+store = event.result
+PASS store.name is "storeName"
+PASS store.keyPath is "keyPath"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/idb-objectstore-request.html b/LayoutTests/storage/indexeddb/idb-objectstore-request.html
new file mode 100644
index 0000000..87c34ea
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/idb-objectstore-request.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/idb-objectstore-request.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js b/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js
new file mode 100644
index 0000000..2951876
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/idb-keyrange.js
@@ -0,0 +1,75 @@
+description("Test IndexedDB's KeyRange.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function checkSingleKeyRange(value)
+{
+ keyRange = evalAndLog("indexedDB.makeSingleKeyRange(" + value + ")");
+ shouldBe("keyRange.left", "" + value);
+ shouldBe("keyRange.right", "" + value);
+ shouldBe("keyRange.flags", "keyRange.SINGLE");
+}
+
+function checkLeftBoundKeyRange(value, open)
+{
+ keyRange = evalAndLog("indexedDB.makeLeftBoundKeyRange(" + value + "," + open + ")");
+ shouldBe("keyRange.left", "" + value);
+ shouldBeNull("keyRange.right");
+ shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN" : "keyRange.LEFT_BOUND");
+}
+
+function checkRightBoundKeyRange(value, open)
+{
+ keyRange = evalAndLog("indexedDB.makeRightBoundKeyRange(" + value + "," + open + ")");
+ shouldBe("keyRange.right", "" + value);
+ shouldBeNull("keyRange.left");
+ shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN" : "keyRange.RIGHT_BOUND");
+}
+
+function checkBoundKeyRange(left, right, openLeft, openRight)
+{
+ keyRange = evalAndLog("indexedDB.makeBoundKeyRange(" + left + "," + right + "," + openLeft + "," + openRight + ")");
+ shouldBe("keyRange.left", "" + left);
+ shouldBe("keyRange.right", "" + right);
+ leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND);
+ shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN" : "keyRange.LEFT_BOUND");
+ rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND);
+ shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN" : "keyRange.RIGHT_BOUND");
+}
+
+function test()
+{
+ checkSingleKeyRange(1);
+ checkSingleKeyRange("'a'");
+
+ checkLeftBoundKeyRange(10, true);
+ checkLeftBoundKeyRange(11, false);
+ checkLeftBoundKeyRange(12);
+ checkLeftBoundKeyRange("'aa'", true);
+ checkLeftBoundKeyRange("'ab'", false);
+ checkLeftBoundKeyRange("'ac'");
+
+ checkRightBoundKeyRange(20, true);
+ checkRightBoundKeyRange(21, false);
+ checkRightBoundKeyRange(22);
+ checkRightBoundKeyRange("'ba'", true);
+ checkRightBoundKeyRange("'bb'", false);
+ checkRightBoundKeyRange("'bc'");
+
+ checkBoundKeyRange(30, 40);
+ checkBoundKeyRange(31, 41, false, false);
+ checkBoundKeyRange(32, 42, false, true);
+ checkBoundKeyRange(33, 43, true, false);
+ checkBoundKeyRange(34, 44, true, true);
+
+ checkBoundKeyRange("'aaa'", "'aba'", false, false);
+ checkBoundKeyRange("'aab'", "'abb'");
+ checkBoundKeyRange("'aac'", "'abc'", false, false);
+ checkBoundKeyRange("'aad'", "'abd'", false, true);
+ checkBoundKeyRange("'aae'", "'abe'", true, false);
+ checkBoundKeyRange("'aaf'", "'abf'", true, true);
+
+ done();
+}
+
+test();
diff --git a/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js b/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js
new file mode 100644
index 0000000..031ece6
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/idb-objectstore-request.js
@@ -0,0 +1,42 @@
+description("Test IndexedDB's IDBObjectStoreRequest.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = indexedDB.open('name', 'description');
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+
+ var db = evalAndLog("db = event.result");
+ createObjectStore(db);
+}
+
+function createObjectStore(db)
+{
+ // FIXME: remove any previously created object stores.
+ // This requires IDBDatabaseRequest::removeObjectStore to be implemented.
+ result = db.createObjectStore('storeName', 'keyPath');
+ verifyResult(result);
+ result.onsuccess = createSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createSuccess()
+{
+ verifySuccessEvent(event);
+ var store = evalAndLog("store = event.result");
+ shouldBeEqualToString("store.name", "storeName");
+ shouldBeEqualToString("store.keyPath", "keyPath");
+ // FIXME: test store.indexNames, as well as all object store's methods.
+
+ done();
+}
+
+test();