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