OLD | NEW |
1 if (this.importScripts) { | 1 if (this.importScripts) { |
2 importScripts('../../../resources/js-test.js'); | 2 importScripts('../../../resources/js-test.js'); |
3 importScripts('shared.js'); | 3 importScripts('shared.js'); |
4 } | 4 } |
5 | 5 |
6 description("Test the basics of IndexedDB's webkitIDBIndex."); | 6 description("Test the basics of IndexedDB's webkitIDBIndex."); |
7 | 7 |
8 indexedDBTest(prepareDatabase); | 8 indexedDBTest(prepareDatabase); |
9 function prepareDatabase(evt) | 9 function prepareDatabase(evt) |
10 { | 10 { |
11 preamble(evt); | 11 preamble(evt); |
12 db = event.target.result; | 12 db = event.target.result; |
13 event.target.transaction.onabort = unexpectedAbortCallback; | 13 event.target.transaction.onabort = unexpectedAbortCallback; |
14 self.store = evalAndLog("db.createObjectStore('storeName', null)"); | 14 self.store = evalAndLog("db.createObjectStore('storeName', null)"); |
15 self.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); | 15 self.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); |
16 self.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', {unique
: false})"); | 16 self.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', {unique
: false})"); |
17 self.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', {unique: tr
ue})"); | 17 self.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', {unique: tr
ue})"); |
| 18 shouldNotThrow("store.createIndex('index4', 'path', undefined)"); |
18 shouldBeFalse("indexObject2.unique"); | 19 shouldBeFalse("indexObject2.unique"); |
19 shouldBeTrue("indexObject3.unique"); | 20 shouldBeTrue("indexObject3.unique"); |
20 evalAndExpectExceptionClass("store.createIndex('failureIndex', 'zzz', true)"
, "TypeError"); | 21 evalAndExpectExceptionClass("store.createIndex('failureIndex', 'zzz', true)"
, "TypeError"); |
21 evalAndExpectExceptionClass("store.createIndex('failureIndex', 'zzz', 'strin
g')", "TypeError"); | 22 evalAndExpectExceptionClass("store.createIndex('failureIndex', 'zzz', 'strin
g')", "TypeError"); |
22 addData(); | 23 addData(); |
23 } | 24 } |
24 | 25 |
25 function addData() | 26 function addData() |
26 { | 27 { |
27 shouldBeTrue("'name' in indexObject"); | 28 shouldBeTrue("'name' in indexObject"); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 shouldBe("event.target.result", "2"); | 316 shouldBe("event.target.result", "2"); |
316 | 317 |
317 debug("Passing an invalid key into indexObject.get({})."); | 318 debug("Passing an invalid key into indexObject.get({})."); |
318 evalAndExpectException("indexObject.get({})", "0", "'DataError'"); | 319 evalAndExpectException("indexObject.get({})", "0", "'DataError'"); |
319 | 320 |
320 debug("Passing an invalid key into indexObject.getKey({})."); | 321 debug("Passing an invalid key into indexObject.getKey({})."); |
321 evalAndExpectException("indexObject.getKey({})", "0", "'DataError'"); | 322 evalAndExpectException("indexObject.getKey({})", "0", "'DataError'"); |
322 | 323 |
323 finishJSTest(); | 324 finishJSTest(); |
324 } | 325 } |
OLD | NEW |