OLD | NEW |
(Empty) | |
| 1 library CacheTest; |
| 2 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_individual_config.dart'; |
| 4 import 'dart:html'; |
| 5 |
| 6 main() { |
| 7 useHtmlIndividualConfiguration(); |
| 8 |
| 9 group('supported', () { |
| 10 test('supported', () { |
| 11 expect(ApplicationCache.supported, true); |
| 12 }); |
| 13 }); |
| 14 |
| 15 group('ApplicationCache', () { |
| 16 test('ApplicationCache', () { |
| 17 var expectation = ApplicationCache.supported ? returnsNormally : throws; |
| 18 expect(() { |
| 19 ApplicationCache appCache = window.applicationCache; |
| 20 expect(cacheStatusToString(appCache.status), "UNCACHED"); |
| 21 }, expectation); |
| 22 |
| 23 }); |
| 24 }); |
| 25 |
| 26 } |
| 27 |
| 28 String cacheStatusToString(int status) { |
| 29 switch (status) { |
| 30 case ApplicationCache.UNCACHED: // UNCACHED == 0 |
| 31 return 'UNCACHED'; |
| 32 case ApplicationCache.IDLE: // IDLE == 1 |
| 33 return 'IDLE'; |
| 34 case ApplicationCache.CHECKING: // CHECKING == 2 |
| 35 return 'CHECKING'; |
| 36 case ApplicationCache.DOWNLOADING: // DOWNLOADING == 3 |
| 37 return 'DOWNLOADING'; |
| 38 case ApplicationCache.UPDATEREADY: // UPDATEREADY == 4 |
| 39 return 'UPDATEREADY'; |
| 40 case ApplicationCache.OBSOLETE: // OBSOLETE == 5 |
| 41 return 'OBSOLETE'; |
| 42 default: |
| 43 return 'UNKNOWN CACHE STATUS'; |
| 44 }; |
| 45 } |
OLD | NEW |