| 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.requestPersistentQuota."); | 7 description("This tests navigator.storageQuota.requestPersistentQuota."); |
| 8 | 8 |
| 9 var usage; | 9 var usage; |
| 10 var grantedQuota; | 10 var grantedQuota; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Quota value would vary depending on the test environment. | 25 // Quota value would vary depending on the test environment. |
| 26 shouldBeGreaterThanOrEqual("usage", "0"); | 26 shouldBeGreaterThanOrEqual("usage", "0"); |
| 27 shouldBeNonZero("grantedQuota"); | 27 shouldBeNonZero("grantedQuota"); |
| 28 | 28 |
| 29 runNextTest(); | 29 runNextTest(); |
| 30 }, onrejected); | 30 }, onrejected); |
| 31 } | 31 } |
| 32 | 32 |
| 33 function runRequestQuotaWithMisingArgumentTest() { | 33 function runRequestQuotaWithMisingArgumentTest() { |
| 34 debug("* Requesting persistent quota with missing argument."); | 34 debug("* Requesting persistent quota with missing argument."); |
| 35 shouldThrow("navigator.storageQuota.requestPersistentQuota()"); | 35 navigator.storageQuota.requestPersistentQuota().then(function() { |
| 36 runNextTest(); | 36 testFailed('resolved unexpectedly'); |
| 37 }, function(e) { |
| 38 testPassed('rejected as expected: ' + e); |
| 39 }).then(runNextTest); |
| 37 } | 40 } |
| 38 | 41 |
| 39 function runRequestQuotaWithNegativeValueTest() { | 42 function runRequestQuotaWithNegativeValueTest() { |
| 40 debug("* Requesting persistent quota with negative value."); | 43 debug("* Requesting persistent quota with negative value."); |
| 41 navigator.storageQuota.requestPersistentQuota(-1024).then(function(storageIn
fo) { | 44 navigator.storageQuota.requestPersistentQuota(-1024).then(function(storageIn
fo) { |
| 42 usage = storageInfo.usage; | 45 usage = storageInfo.usage; |
| 43 grantedQuota = storageInfo.quota; | 46 grantedQuota = storageInfo.quota; |
| 44 | 47 |
| 45 // Quota value would vary depending on the test environment. | 48 // Quota value would vary depending on the test environment. |
| 46 shouldBeGreaterThanOrEqual("usage", "0"); | 49 shouldBeGreaterThanOrEqual("usage", "0"); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 70 | 73 |
| 71 if (navigator.storageQuota) { | 74 if (navigator.storageQuota) { |
| 72 window.jsTestIsAsync = true; | 75 window.jsTestIsAsync = true; |
| 73 runNextTest(); | 76 runNextTest(); |
| 74 } else { | 77 } else { |
| 75 debug("This test requires navigator.storageQuota."); | 78 debug("This test requires navigator.storageQuota."); |
| 76 } | 79 } |
| 77 </script> | 80 </script> |
| 78 </body> | 81 </body> |
| 79 </html> | 82 </html> |
| OLD | NEW |