blob: fbd45cdf5f980d9be008f9e462538558e9ab011d [file] [log] [blame]
<!DOCTYPE html>
<!--
original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_global_data.html
license of original test:
" Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ "
-->
<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="../resources/shared.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Test IndexedDB's objectStoreNames array");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function test()
{
indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
shouldBeFalse("indexedDB == null");
name = window.location.pathname;
description = "My Test Database";
request = evalAndLog("indexedDB.open(name, description)");
request.onsuccess = openSuccess;
request.onerror = unexpectedErrorCallback;
}
function openSuccess()
{
db = evalAndLog("db = event.target.result");
request = evalAndLog("request = db.setVersion('1')");
request.onsuccess = cleanDatabase;
request.onerror = unexpectedErrorCallback;
}
function cleanDatabase()
{
deleteAllObjectStores(db);
objectStoreName = "a";
objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName, { keyPath: 'id', autoIncrement: true });");
shouldBeTrue("'objectStoreNames' in db");
shouldBe("db.objectStoreNames.length", "1");
shouldBe("db.objectStoreNames.item(0)", "objectStoreName");
done();
}
var successfullyParsed = true;
test();
</script>
</body>
</html>