diff options
author | Steve Block <steveblock@google.com> | 2010-08-27 11:02:25 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-02 17:17:20 +0100 |
commit | e8b154fd68f9b33be40a3590e58347f353835f5c (patch) | |
tree | 0733ce26384183245aaa5656af26c653636fe6c1 /LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html | |
parent | da56157816334089526a7a115a85fd85a6e9a1dc (diff) | |
download | external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.zip external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.gz external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.bz2 |
Merge WebKit at r66079 : Initial merge by git
Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7
Diffstat (limited to 'LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html')
-rw-r--r-- | LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html new file mode 100644 index 0000000..e842f5b --- /dev/null +++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html @@ -0,0 +1,115 @@ +<html> +<head> +<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> +<script src="../../fast/js/resources/js-test-pre.js"></script> +<script src="../../fast/js/resources/js-test-post-function.js"></script> +<script src="resources/shared.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script> + +description("Test IndexedDB's IDBObjectStore.removeObjectStore()."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function test() +{ + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = createObjectStore; + result.onerror = unexpectedErrorCallback; +} + +function createObjectStore() +{ + verifySuccessEvent(event); + db = evalAndLog("db = event.result"); + + deleteAllObjectStores(db); + + result = evalAndLog("db.createObjectStore('storeName', null)"); + verifyResult(result); + result.onsuccess = addValue; + result.onerror = unexpectedErrorCallback; +} + +function addValue() +{ + verifySuccessEvent(event); + + result = evalAndLog("event.result.add('value', 'key')"); + verifyResult(result); + result.onsuccess = getValue; + result.onerror = unexpectedErrorCallback; +} + +function getValue() +{ + verifySuccessEvent(event); + + result = evalAndLog("event.source.get('key')"); + verifyResult(result); + result.onsuccess = addIndex; + result.onerror = unexpectedErrorCallback; +} + +function addIndex() +{ + verifySuccessEvent(event); + shouldBeEqualToString("event.result", "value"); + + result = evalAndLog("event.source.createIndex('indexName', '')"); + verifyResult(result); + result.onsuccess = removeObjectStore; + result.onerror = unexpectedErrorCallback; +} + +function removeObjectStore() +{ + verifySuccessEvent(event); + shouldBeTrue("event.source.indexNames.contains('indexName')"); + + result = evalAndLog("db.removeObjectStore('storeName')"); + verifyResult(result); + result.onsuccess = createObjectStoreAgain; + result.onerror = unexpectedErrorCallback; +} + +function createObjectStoreAgain() +{ + verifySuccessEvent(event); + + result = evalAndLog("db.createObjectStore('storeName', null)"); + verifyResult(result); + result.onsuccess = getValueAgain; + result.onerror = unexpectedErrorCallback; +} + +function getValueAgain() +{ + verifySuccessEvent(event); + + result = evalAndLog("event.result.get('key')"); + verifyResult(result); + result.onsuccess = unexpectedSuccessCallback; + result.onerror = verifyError; +} + +function verifyError() +{ + verifyErrorEvent(event); + // FIXME: Should just be IDBDatabaseException.NOT_FOUND_ERR but that doesn't work yet. + shouldBe("event.code", "2"); + shouldBeFalse("event.source.indexNames.contains('indexName')"); + + done(); +} + +test(); + +var successfullyParsed = true; +</script> +</body> +</html> |