Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / deleteIndex.js
blob299c1a25b6ea3a4b36bb99cf83f8977f6b77ce93
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("Test IndexedDB deleteIndex method");
8 indexedDBTest(prepareDatabase, postTwiddling);
9 function prepareDatabase()
11     db = event.target.result;
12     objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
13     evalAndExpectException("objectStore.deleteIndex('first')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
14     shouldThrow("objectStore.deleteIndex()"); // TypeError: not enough arguments.
15     index = evalAndLog("index = objectStore.createIndex('first', 'first');");
16     evalAndExpectException("objectStore.deleteIndex('FIRST')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
17     index = evalAndLog("index = objectStore.createIndex('second', 'second');");
18     returnValue = evalAndLog("returnValue = objectStore.deleteIndex('first');");
19     shouldBe("returnValue", "undefined");
22 function postTwiddling()
24     evalAndExpectException("db.createObjectStore('bar');", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
25     evalAndExpectException("objectStore.deleteIndex('second')", "0", "'TransactionInactiveError'");
26     finishJSTest();