blob: 68423cb23bd5f3f9433fa64d0a4f69612e46e0b9 [file] [log] [blame]
Test IndexedDB keys ordering and readback from cursors.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store')
store.createIndex('index', '')
populating store...
trans = db.transaction('store', 'readwrite')
store = trans.objectStore('store');
store.put(1, 1)
store.put(2, 2)
store.put(3, 3)
testCursor()
trans = db.transaction('store', 'readonly')
store = trans.objectStore('store');
index = store.index('index');
upperBound: 7 open: false expected: 3
storeReq = store.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexReq = index.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexKeyReq = index.openKeyCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.primaryKey is test.expected
testCursor()
trans = db.transaction('store', 'readonly')
store = trans.objectStore('store');
index = store.index('index');
upperBound: 7 open: true expected: 3
storeReq = store.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexReq = index.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexKeyReq = index.openKeyCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.primaryKey is test.expected
testCursor()
trans = db.transaction('store', 'readonly')
store = trans.objectStore('store');
index = store.index('index');
upperBound: 3 open: false expected: 3
storeReq = store.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexReq = index.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexKeyReq = index.openKeyCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.primaryKey is test.expected
testCursor()
trans = db.transaction('store', 'readonly')
store = trans.objectStore('store');
index = store.index('index');
upperBound: 3 open: true expected: 2
storeReq = store.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexReq = index.openCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
indexKeyReq = index.openKeyCursor(IDBKeyRange.upperBound(test.upperBound, test.open), 'prev')
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.value is test.expected
PASS cursor.primaryKey is test.expected
cursor = event.target.result
PASS cursor.key is test.expected
PASS cursor.primaryKey is test.expected
testCursor()
No more tests.
PASS successfullyParsed is true
TEST COMPLETE