blob: f30121b29f284d60a2f34b8e4e1562f31abf1d99 [file] [log] [blame]
Exercise optional arguments with missing vs. undefined in IndexedDB methods.
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)
prepareDatabase():
db = event.target.result
store = db.createObjectStore('store', {keyPath: 'id'})
store.createIndex('by_name', 'name', {unique: true})
store.put({id: 1, name: 'a'})
tx = db.transaction('store', 'readwrite')
store = tx.objectStore('store')
index = store.index('by_name')
PASS IDBKeyRange.lowerBound(0).lowerOpen is false
PASS IDBKeyRange.upperBound(0).upperOpen is false
PASS IDBKeyRange.bound(0, 1).lowerOpen is false
PASS IDBKeyRange.bound(0, 1).upperOpen is false
PASS IDBKeyRange.lowerBound(0, undefined).lowerOpen is false
PASS IDBKeyRange.upperBound(0, undefined).upperOpen is false
PASS IDBKeyRange.bound(0, 1, undefined, undefined).lowerOpen is false
PASS IDBKeyRange.bound(0, 1, undefined, undefined).upperOpen is false
PASS store.add({id: 2, name: 'b'}) did not throw exception.
PASS store.put({id: 3, name: 'c'}) did not throw exception.
PASS store.add({id: 4, name: 'd'}, undefined) did not throw exception.
PASS store.put({id: 5, name: 'e'}, undefined) did not throw exception.
verifyCursor():
request = store.openCursor()
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = store.openCursor(null)
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = store.openCursor(IDBKeyRange.lowerBound(4))
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 2
verifyCursor():
request = store.openCursor(3)
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 1
verifyCursor():
request = index.openCursor()
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = index.openCursor(null)
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = index.openCursor(IDBKeyRange.lowerBound('b'))
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 4
verifyCursor():
request = index.openCursor('c')
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 1
verifyCursor():
request = index.openKeyCursor()
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = index.openKeyCursor(null)
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 5
verifyCursor():
request = index.openKeyCursor(IDBKeyRange.lowerBound('b'))
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 4
verifyCursor():
request = index.openKeyCursor('c')
cursor = request.result
PASS cursor.direction is "next"
PASS continues is 1
verifyCount():
request = store.count()
PASS request.result is 5
verifyCount():
request = store.count(null)
PASS request.result is 5
verifyCount():
request = store.count(IDBKeyRange.lowerBound(2))
PASS request.result is 4
verifyCount():
request = index.count()
PASS request.result is 5
verifyCount():
request = index.count(null)
PASS request.result is 5
verifyCount():
request = index.count(IDBKeyRange.lowerBound('b'))
PASS request.result is 4
continueUndefined():
request = store.openCursor()
cursor = request.result
PASS request.result is non-null.
PASS cursor.continue(undefined) did not throw exception.
PASS successfullyParsed is true
TEST COMPLETE