Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / quota / storageinfo-no-callbacks.html
blobeedca8616717bf4d022bde99b049e214763e5c0c
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <p id="description"></p>
7 <div id="console"></div>
8 <script type="text/javascript">
9 description("This tests webkitStorageInfo methods do not crash when they are not given optional callbacks parameters.");
11 var testFinished = false;
12 var numberOfExpectedCallbacks = 0;
14 function callback()
16 testPassed("storageInfo callback called.");
17 --numberOfExpectedCallbacks;
18 checkCompleted();
21 function checkCompleted()
23 if (numberOfExpectedCallbacks == 0 && testFinished)
24 finishJSTest();
27 function isValidStorageType(type)
29 return (type == webkitStorageInfo.TEMPORARY || type == webkitStorageInfo.PERSISTENT);
32 function callStorageInfoMethodsWithFewerParameters(type)
34 webkitStorageInfo.requestQuota(type, 0);
35 webkitStorageInfo.queryUsageAndQuota(type);
36 if (isValidStorageType(type))
37 ++numberOfExpectedCallbacks;
38 webkitStorageInfo.requestQuota(type, 0, callback);
39 if (isValidStorageType(type))
40 ++numberOfExpectedCallbacks;
41 webkitStorageInfo.queryUsageAndQuota(type, callback);
44 if (window.webkitStorageInfo) {
45 window.jsTestIsAsync = true;
47 // Any of the following attempts should not cause crashing.
48 callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.TEMPORARY);
49 callStorageInfoMethodsWithFewerParameters(webkitStorageInfo.PERSISTENT);
50 callStorageInfoMethodsWithFewerParameters(10);
52 testFinished = true;
53 checkCompleted();
54 } else {
55 debug("This test requires window.webkitStorageInfo.");
57 </script>
58 </body>
59 </html>