blob: ccd0d4588d6a8deb404b3db81772b59ae25ce9d8 [file] [log] [blame]
[Worker] Test the basics of IndexedDB's webkitIDBIndex.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Starting worker: resources/index-basics.js
[Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
[Worker]
[Worker] indexedDB.deleteDatabase(dbname)
[Worker] indexedDB.open(dbname)
[Worker]
[Worker] prepareDatabase():
[Worker] db.createObjectStore('storeName', null)
[Worker] store.createIndex('indexName', 'x')
[Worker] store.createIndex('indexName2', 'y', {unique: false})
[Worker] store.createIndex('zIndex', 'z', {unique: true})
PASS [Worker] store.createIndex('index4', 'path', undefined) did not throw exception.
PASS [Worker] indexObject2.unique is false
PASS [Worker] indexObject3.unique is true
[Worker] Expecting TypeError exception from store.createIndex('failureIndex', 'zzz', true)
PASS [Worker] Exception was thrown.
PASS [Worker] store.createIndex('failureIndex', 'zzz', true) threw TypeError: Type error
[Worker] Expecting TypeError exception from store.createIndex('failureIndex', 'zzz', 'string')
PASS [Worker] Exception was thrown.
PASS [Worker] store.createIndex('failureIndex', 'zzz', 'string') threw TypeError: Type error
PASS [Worker] 'name' in indexObject is true
PASS [Worker] indexObject.name is "indexName"
PASS [Worker] 'objectStore' in indexObject is true
PASS [Worker] indexObject.objectStore.name is "storeName"
PASS [Worker] 'keyPath' in indexObject is true
PASS [Worker] indexObject.keyPath is "x"
PASS [Worker] 'unique' in indexObject is true
PASS [Worker] 'multiEntry' in indexObject is true
PASS [Worker] indexObject.unique is false
PASS [Worker] indexObject.multiEntry is false
PASS [Worker] 'openKeyCursor' in indexObject is true
PASS [Worker] typeof indexObject.openKeyCursor is "function"
PASS [Worker] 'openCursor' in indexObject is true
PASS [Worker] typeof indexObject.openCursor is "function"
PASS [Worker] 'getKey' in indexObject is true
PASS [Worker] typeof indexObject.getKey is "function"
PASS [Worker] 'get' in indexObject is true
PASS [Worker] typeof indexObject.get is "function"
PASS [Worker] 'count' in indexObject is true
PASS [Worker] typeof indexObject.count is "function"
[Worker] store.add({x: 'value', y: 'zzz', z: 2.72}, 'key')
[Worker] event.target.source.add({x: 'value2', y: 'zzz2', z: 2.71, foobar: 12}, 'key2')
[Worker] store.createIndex('indexWhileAddIsInFlight', 'x')
[Worker] store.createIndex('indexWithWeirdKeyPath', 'foobar')
[Worker] Add data which doesn't have a key in the z index.
[Worker] event.target.source.add({x: 'value3', y: '456'}, 'key3')
[Worker] Add data which has invalid key for y index, no key for the z index.
[Worker] event.target.source.add({x: 'value4', y: null}, 'key4')
[Worker] indexObject.getKey('value')
PASS [Worker] event.target.result is "key"
[Worker] indexObject2.getKey('zzz')
PASS [Worker] event.target.result is "key"
[Worker] indexObject3.get(2.71)
PASS [Worker] event.target.result.x is "value2"
[Worker] indexObject.get('value')
PASS [Worker] event.target.result.x is "value"
PASS [Worker] event.target.result.y is "zzz"
[Worker] indexObject.getKey('does not exist')
PASS [Worker] event.target.result is undefined
[Worker] indexObject.get('does not exist')
PASS [Worker] event.target.result is undefined
[Worker] indexObject4.getKey('value2')
PASS [Worker] event.target.result is "key2"
[Worker]
[Worker] Verify that specifying an invalid direction raises an exception:
[Worker] Expecting TypeError exception from indexObject.openKeyCursor(0, 'invalid-direction')
PASS [Worker] Exception was thrown.
PASS [Worker] indexObject.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
[Worker]
[Worker] indexObject.openKeyCursor()
PASS [Worker] event.target.source is indexObject
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value"
PASS [Worker] event.target.result.primaryKey is "key"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value2"
PASS [Worker] event.target.result.primaryKey is "key2"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value3"
PASS [Worker] event.target.result.primaryKey is "key3"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value4"
PASS [Worker] event.target.result.primaryKey is "key4"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is null
[Worker]
[Worker] Verify that specifying an invalid direction raises an exception:
[Worker] Expecting TypeError exception from indexObject.openCursor(0, 'invalid-direction')
PASS [Worker] Exception was thrown.
PASS [Worker] indexObject.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
[Worker]
[Worker] indexObject.openCursor()
PASS [Worker] event.target.source is indexObject
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value"
PASS [Worker] event.target.result.value.x is "value"
PASS [Worker] event.target.result.value.y is "zzz"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value2"
PASS [Worker] event.target.result.value.x is "value2"
PASS [Worker] event.target.result.value.y is "zzz2"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value3"
PASS [Worker] event.target.result.value.x is "value3"
PASS [Worker] event.target.result.value.y is "456"
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is non-null.
PASS [Worker] event.target.result.key is "value4"
PASS [Worker] event.target.result.value.x is "value4"
PASS [Worker] event.target.result.value.y is null
[Worker] event.target.result.continue()
PASS [Worker] event.target.result is null
[Worker] request = indexObject.count()
PASS [Worker] event.target.result is 4
[Worker] request = indexObject2.count()
PASS [Worker] event.target.result is 3
[Worker] request = indexObject3.count()
PASS [Worker] event.target.result is 2
[Worker] Passing an invalid key into indexObject.get({}).
[Worker] Expecting exception from indexObject.get({})
PASS [Worker] Exception was thrown.
PASS [Worker] code is 0
PASS [Worker] ename is 'DataError'
[Worker] Exception message: Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.
[Worker] Passing an invalid key into indexObject.getKey({}).
[Worker] Expecting exception from indexObject.getKey({})
PASS [Worker] Exception was thrown.
PASS [Worker] code is 0
PASS [Worker] ename is 'DataError'
[Worker] Exception message: Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.
PASS successfullyParsed is true
TEST COMPLETE