| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
| 4 </head> | 4 </head> |
| 5 <body> | 5 <body> |
| 6 <script type="text/javascript"> | 6 <script type="text/javascript"> |
| 7 description("This tests navigator.storageQuota.queryInfo."); | 7 description("This tests navigator.storageQuota.queryInfo."); |
| 8 | 8 |
| 9 var info; |
| 9 var usage; | 10 var usage; |
| 10 var quota; | 11 var quota; |
| 11 | 12 |
| 12 function onrejected(error) { | 13 function onrejected(error) { |
| 13 testFailed(error.name + ": " + error.message); | 14 testFailed(error.name + ": " + error.message); |
| 14 finishJSTest(); | 15 finishJSTest(); |
| 15 } | 16 } |
| 16 | 17 |
| 17 // Test body functions ---------------------------------------------------- | 18 // Test body functions ---------------------------------------------------- |
| 18 | 19 |
| 19 function runQueryTemporaryTest() { | 20 function runQueryTemporaryTest() { |
| 20 debug("* Querying about temporary storage."); | 21 debug("* Querying about temporary storage."); |
| 21 navigator.storageQuota.queryInfo("temporary").then(function(storageInfo) { | 22 navigator.storageQuota.queryInfo("temporary").then(function(storageInfo) { |
| 23 info = storageInfo; |
| 24 shouldBe("info.__proto__", "Object.prototype"); |
| 25 |
| 22 usage = storageInfo.usage; | 26 usage = storageInfo.usage; |
| 23 quota = storageInfo.quota; | 27 quota = storageInfo.quota; |
| 24 | 28 |
| 25 // Quota value would vary depending on the test environment. | 29 // Quota value would vary depending on the test environment. |
| 26 shouldBeGreaterThanOrEqual("usage", "0"); | 30 shouldBeGreaterThanOrEqual("usage", "0"); |
| 27 shouldBeGreaterThanOrEqual("quota", "usage"); | 31 shouldBeGreaterThanOrEqual("quota", "usage"); |
| 28 | 32 |
| 29 runNextTest(); | 33 runNextTest(); |
| 30 }, onrejected); | 34 }, onrejected); |
| 31 } | 35 } |
| 32 | 36 |
| 33 function runQueryPersistentTest() { | 37 function runQueryPersistentTest() { |
| 34 debug("* Querying about persistent storage."); | 38 debug("* Querying about persistent storage."); |
| 35 navigator.storageQuota.queryInfo("persistent").then(function(storageInfo) { | 39 navigator.storageQuota.queryInfo("persistent").then(function(storageInfo) { |
| 40 info = storageInfo; |
| 41 shouldBe("info.__proto__", "Object.prototype"); |
| 42 |
| 36 usage = storageInfo.usage; | 43 usage = storageInfo.usage; |
| 37 quota = storageInfo.quota; | 44 quota = storageInfo.quota; |
| 38 | 45 |
| 39 // Quota value would vary depending on the test environment. | 46 // Quota value would vary depending on the test environment. |
| 40 shouldBeGreaterThanOrEqual("usage", "0"); | 47 shouldBeGreaterThanOrEqual("usage", "0"); |
| 41 shouldBeGreaterThanOrEqual("quota", "usage"); | 48 shouldBeGreaterThanOrEqual("quota", "usage"); |
| 42 | 49 |
| 43 runNextTest(); | 50 runNextTest(); |
| 44 }, onrejected); | 51 }, onrejected); |
| 45 } | 52 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 90 |
| 84 if (navigator.storageQuota) { | 91 if (navigator.storageQuota) { |
| 85 window.jsTestIsAsync = true; | 92 window.jsTestIsAsync = true; |
| 86 runNextTest(); | 93 runNextTest(); |
| 87 } else { | 94 } else { |
| 88 debug("This test requires navigator.storageQuota."); | 95 debug("This test requires navigator.storageQuota."); |
| 89 } | 96 } |
| 90 </script> | 97 </script> |
| 91 </body> | 98 </body> |
| 92 </html> | 99 </html> |
| OLD | NEW |