blob: 6c85c388a71c8c89aa074a4529a9a78f5257b246 [file] [log] [blame]
<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("Verify that queuing up several commands works (and they all fire).");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function test()
{
request = evalAndLog("webkitIndexedDB.open('queued-commands')");
request.onsuccess = setVersion;
request.onerror = unexpectedErrorCallback;
}
function setVersion()
{
db = evalAndLog("db = event.target.result");
request = evalAndLog("db.setVersion('new version')");
request.onsuccess = deleteExisting;
request.onerror = unexpectedErrorCallback;
}
function deleteExisting()
{
debug("setVersionSuccess():");
window.trans = evalAndLog("trans = event.target.result");
shouldBeTrue("trans !== null");
trans.onabort = unexpectedAbortCallback;
deleteAllObjectStores(db);
window.store = evalAndLog("db.createObjectStore('storeName')");
window.indexObject = evalAndLog("store.createIndex('indexName', 'x')");
request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
request.onsuccess = function() { verifyAdd(0); };
request.onerror = unexpectedErrorCallback;
request = evalAndLog("store.add({x: 'value2', y: 'zzz2'}, 'key2')");
request.onsuccess = function() { verifyAdd(1); };
request.onerror = unexpectedErrorCallback;
request = evalAndLog("store.put({x: 'valu2', y: 'zz2'}, 'ky2')");
request.onsuccess = function() { verifyAdd(2); };
request.onerror = unexpectedErrorCallback;
window.addCount = 0;
}
function verifyAdd(expected)
{
shouldBe("" + addCount++, "" + expected);
if (addCount == 3)
done();
if (addCount > 3)
testFailed("Unexpected call to verifyAdd!");
}
test();
var successfullyParsed = true;
</script>
</body>
</html>