| OLD | NEW |
| (Empty) |
| 1 library storage_quota_test; | |
| 2 | |
| 3 import 'package:unittest/unittest.dart'; | |
| 4 import 'package:unittest/html_config.dart'; | |
| 5 | |
| 6 import 'dart:async'; | |
| 7 import 'dart:isolate'; | |
| 8 import 'dart:html'; | |
| 9 | |
| 10 main() { | |
| 11 useHtmlConfiguration(); | |
| 12 | |
| 13 expectSaneStorageInfo(StorageInfo storageInfo) { | |
| 14 expect(storageInfo.usage, isNotNull); | |
| 15 expect(storageInfo.quota, isNotNull); | |
| 16 expect(storageInfo.usage >= 0, isTrue); | |
| 17 expect(storageInfo.quota >= storageInfo.usage, isNotNull); | |
| 18 }; | |
| 19 | |
| 20 test('storage quota - temporary', () { | |
| 21 Future f = window.navigator.storageQuota.queryInfo('temporary'); | |
| 22 expect(f.then(expectSaneStorageInfo), completes); | |
| 23 }); | |
| 24 | |
| 25 test('storage quota - persistent', () { | |
| 26 Future f = window.navigator.storageQuota.queryInfo('persistent'); | |
| 27 expect(f.then(expectSaneStorageInfo), completes); | |
| 28 }); | |
| 29 | |
| 30 test('storage quota - unknown', () { | |
| 31 // Throwing synchronously is bogus upstream behavior; should result in a | |
| 32 // smashed promise. | |
| 33 expect(() => window.navigator.storageQuota.queryInfo("foo"), throws); /// m
issingenumcheck: ok | |
| 34 expect(() => window.navigator.storageQuota.queryInfo(3), throws); | |
| 35 expect(() => window.navigator.storageQuota.queryInfo(null), throws); | |
| 36 }); | |
| 37 } | |
| OLD | NEW |