blob: 593046d36269f9d433c696b231b532fffbc8cd12 [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("Test IndexedDB's basics.");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function test()
{
shouldBeTrue("'webkitIndexedDB' in window");
shouldBeFalse("webkitIndexedDB == null");
shouldBeTrue("'webkitIDBCursor' in window");
shouldBeFalse("webkitIDBCursor == null");
request = evalAndLog("webkitIndexedDB.open('basics')");
shouldBeTrue("'result' in request");
evalAndExpectException("request.result", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'errorCode' in request");
evalAndExpectException("request.errorCode", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'webkitErrorMessage' in request");
evalAndExpectException("request.webkitErrorMessage", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'source' in request");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in request");
shouldBeNull("request.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("request.readyState", "webkitIDBRequest.LOADING");
shouldBeTrue("'onsuccess' in request");
shouldBeNull("request.onsuccess");
shouldBeTrue("'onerror' in request");
shouldBeNull("request.onerror");
shouldBe("request.LOADING", "1");
shouldBe("request.DONE", "2");
request.onsuccess = openCallback;
request.onerror = unexpectedErrorCallback;
}
function openCallback()
{
shouldBeTrue("'result' in event.target");
shouldBeTrue("!!event.target.result");
shouldBeTrue("'errorCode' in event.target");
shouldBe("event.target.errorCode", "0");
shouldBeTrue("'webkitErrorMessage' in event.target");
shouldBeUndefined("event.target.webkitErrorMessage");
shouldBeTrue("'source' in event.target");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in event.target");
shouldBeNull("event.target.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("event.target.readyState", "webkitIDBRequest.DONE");
shouldBeTrue("'onsuccess' in event.target");
shouldBeTrue("'onerror' in event.target");
shouldBe("event.target.LOADING", "1");
shouldBe("event.target.DONE", "2");
done();
}
test();
var successfullyParsed = true;
</script>
</body>
</html>