| Test IndexedDB index population. |
| |
| 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) |
| transaction = event.target.transaction |
| store = db.createObjectStore('store1') |
| store.put({data: 'a', indexKey: 10}, 1) |
| store.put({data: 'b', indexKey: 20}, 2) |
| store.put({data: 'c', indexKey: 10}, 3) |
| store.put({data: 'd', indexKey: 20}, 4) |
| index = store.createIndex('index1', 'indexKey') |
| PASS index instanceof IDBIndex is true |
| PASS index.unique is false |
| request = index.count(IDBKeyRange.bound(-Infinity, Infinity)) |
| PASS request.result is 4 |
| |
| doSetVersion2(): |
| db.close() |
| request = indexedDB.open(dbname, 2) |
| |
| setVersion2(): |
| transaction = request.transaction |
| store = db.createObjectStore('store2') |
| store.put({data: 'a', indexKey: 10}, 1) |
| store.put({data: 'b', indexKey: 20}, 2) |
| store.put({data: 'c', indexKey: 10}, 3) |
| store.put({data: 'd', indexKey: 20}, 4) |
| index2 = store.createIndex('index2', 'indexKey', { unique: true }) |
| PASS index2 instanceof IDBIndex is true |
| PASS index2.unique is true |
| |
| setVersion2Abort(): |
| PASS db.objectStoreNames.length is 1 |
| PASS db.objectStoreNames[0] is "store1" |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |