blob: eedca8616717bf4d022bde99b049e214763e5c0c [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
description("This tests webkitStorageInfo methods do not crash when they are not given optional callbacks parameters.");
var testFinished = false;
var numberOfExpectedCallbacks = 0;
function callback()
{
testPassed("storageInfo callback called.");
--numberOfExpectedCallbacks;
checkCompleted();
}
function checkCompleted()
{
if (numberOfExpectedCallbacks == 0 && testFinished)
finishJSTest();
}
function isValidStorageType(type)
{
return (type == webkitStorageInfo.TEMPORARY || type == webkitStorageInfo.PERSISTENT);
}
function callStorageInfoMethodsWithFewerParameters(type)
{
webkitStorageInfo.requestQuota(type, 0);
webkitStorageInfo.queryUsageAndQuota(type);
if (isValidStorageType(type))
++numberOfExpectedCallbacks;
webkitStorageInfo.requestQuota(type, 0, callback);
if (isValidStorageType(type))
++numberOfExpectedCallbacks;
webkitStorageInfo.queryUsageAndQuota(type, callback);
}
if (window.webkitStorageInfo) {
window.jsTestIsAsync = true;
// Any of the following attempts should not cause crashing.
callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.TEMPORARY);
callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.PERSISTENT);
callStorageInfoMethodsWithFewerParameters(10);
testFinished = true;
checkCompleted();
} else {
debug("This test requires window.webkitStorageInfo.");
}
</script>
</body>
</html>