<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script>

description("This tests querying usage and quota using Quota API.");

function errorCallback(error)
{
    testFailed("Error occurred: " + error);
    finishJSTest();
}

var returnedUsage, returnedQuota;
function usageCallback(usage, quota)
{
    returnedUsage = usage;
    returnedQuota = quota;

    // Usage should be 0 (if other storage tests have correctly cleaned up their test data before exiting).
    shouldBe("returnedUsage", "0");

    // Quota value would vary depending on the test environment.
    shouldBeGreaterThanOrEqual("returnedQuota", "returnedUsage");

    finishJSTest();
}

if (navigator.webkitTemporaryStorage) {
    window.jsTestIsAsync = true;
    navigator.webkitTemporaryStorage.queryUsageAndQuota(usageCallback, errorCallback);
}

window.successfullyParsed = true;

</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>
