diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /LayoutTests/storage/indexeddb/database-basics.html | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'LayoutTests/storage/indexeddb/database-basics.html')
-rw-r--r-- | LayoutTests/storage/indexeddb/database-basics.html | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/LayoutTests/storage/indexeddb/database-basics.html b/LayoutTests/storage/indexeddb/database-basics.html index 9c92194..b099a49 100644 --- a/LayoutTests/storage/indexeddb/database-basics.html +++ b/LayoutTests/storage/indexeddb/database-basics.html @@ -8,6 +8,80 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/database-basics.js"></script> +<script> + +description("Test the basics of IndexedDB's IDBDatabase."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function openSuccess() +{ + verifySuccessEvent(event); + + var db = evalAndLog("db = event.result"); + deleteAllObjectStores(db); + + // We must do something asynchronous before anything synchronous since + // deleteAllObjectStores only schedules the object stores to be removed. + // We don't know for sure whether it's happened until an IDBRequest object + // that was created after the removes fires. + + debug("Testing setVersion."); + result = evalAndLog('db.setVersion("version a")'); + verifyResult(result); + result.onsuccess = setVersionAgain; + result.onError = unexpectedErrorCallback; +} + +function setVersionAgain() +{ + verifySuccessEvent(event); + + result = evalAndLog('db.setVersion("version b")'); + verifyResult(result); + result.onsuccess = createObjectStore; + result.onError = unexpectedErrorCallback; +} + +function createObjectStore() +{ + verifySuccessEvent(event); + shouldBeEqualToString("db.version", "version b"); + shouldBeEqualToString("db.name", "name"); + shouldBe("db.objectStores", "[]"); + shouldBe("db.objectStores.length", "0"); + shouldBe("db.objectStores.contains('')", "false"); + + result = evalAndLog('db.createObjectStore("test123")'); + verifyResult(result); + result.onsuccess = checkObjectStore; + result.onError = unexpectedErrorCallback; +} + +function checkObjectStore() +{ + verifySuccessEvent(event); + shouldBe("db.objectStores", "['test123']"); + shouldBe("db.objectStores.length", "1"); + shouldBe("db.objectStores.contains('')", "false"); + shouldBe("db.objectStores.contains('test456')", "false"); + shouldBe("db.objectStores.contains('test123')", "true"); + + done(); +} + +function test() +{ + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> |