OLD | NEW |
1 // original test: | 1 // original test: |
2 // http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_remove_index
.html | 2 // http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_remove_index
.html |
3 // license of original test: | 3 // license of original test: |
4 // " Any copyright is dedicated to the Public Domain. | 4 // " Any copyright is dedicated to the Public Domain. |
5 // http://creativecommons.org/publicdomain/zero/1.0/ " | 5 // http://creativecommons.org/publicdomain/zero/1.0/ " |
6 | 6 |
7 if (this.importScripts) { | 7 if (this.importScripts) { |
8 importScripts('../../../../resources/js-test.js'); | 8 importScripts('../../../../resources/js-test.js'); |
9 importScripts('../../resources/shared.js'); | 9 importScripts('../../resources/shared.js'); |
10 } | 10 } |
11 | 11 |
12 description("Test IndexedDB's creating and deleting indexes"); | 12 description("Test IndexedDB's creating and deleting indexes"); |
13 | 13 |
14 indexedDBTest(prepareDatabase); | 14 indexedDBTest(prepareDatabase); |
15 function prepareDatabase() | 15 function prepareDatabase() |
16 { | 16 { |
17 db = event.target.result; | 17 db = event.target.result; |
18 event.target.transaction.onabort = unexpectedAbortCallback; | 18 event.target.transaction.onabort = unexpectedAbortCallback; |
19 | 19 |
20 objectStoreName = "test store"; | 20 objectStoreName = "test store"; |
21 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); | 21 objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName
, { keyPath: 'foo' });"); |
22 shouldBe("db.objectStoreNames.length", "1"); | 22 shouldBe("db.objectStoreNames.length", "1"); |
23 shouldBe("db.objectStoreNames.item(0)", "objectStoreName"); | 23 shouldBe("db.objectStoreNames[0]", "objectStoreName"); |
24 shouldBe("objectStore.indexNames.length", "0"); | 24 shouldBe("objectStore.indexNames.length", "0"); |
25 | 25 |
26 indexName = "My Test Index"; | 26 indexName = "My Test Index"; |
27 index = evalAndLog("index = objectStore.createIndex(indexName, 'foo');"); | 27 index = evalAndLog("index = objectStore.createIndex(indexName, 'foo');"); |
28 shouldBe("objectStore.indexNames.length", "1"); | 28 shouldBe("objectStore.indexNames.length", "1"); |
29 shouldBe("objectStore.indexNames.item(0)", "indexName"); | 29 shouldBe("objectStore.indexNames[0]", "indexName"); |
30 | 30 |
31 evalAndLog("objectStore.deleteIndex(indexName);"); | 31 evalAndLog("objectStore.deleteIndex(indexName);"); |
32 shouldBe("objectStore.indexNames.length", "0"); | 32 shouldBe("objectStore.indexNames.length", "0"); |
33 | 33 |
34 finishJSTest(); | 34 finishJSTest(); |
35 } | 35 } |
OLD | NEW |