summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/script-tests/storageinfo-query-usage.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/script-tests/storageinfo-query-usage.js')
-rw-r--r--LayoutTests/storage/script-tests/storageinfo-query-usage.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/LayoutTests/storage/script-tests/storageinfo-query-usage.js b/LayoutTests/storage/script-tests/storageinfo-query-usage.js
new file mode 100644
index 0000000..8af9232
--- /dev/null
+++ b/LayoutTests/storage/script-tests/storageinfo-query-usage.js
@@ -0,0 +1,31 @@
+description("This tests webkitStorageInfo API works.");
+
+function errorCallback(error)
+{
+ testFailed("Error occurred: " + error);
+ finishJSTest();
+}
+
+var returnedUsage;
+var 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 (window.webkitStorageInfo) {
+ window.jsTestIsAsync = true;
+ webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.TEMPORARY, usageCallback, errorCallback);
+} else
+ debug("This test requires window.webkitStorageInfo.");
+
+window.successfullyParsed = true;