forked from dart-lang/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cache_test.dart
45 lines (40 loc) · 1.2 KB
/
cache_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
library CacheTest;
import 'package:unittest/unittest.dart';
import 'package:unittest/html_individual_config.dart';
import 'dart:html';
main() {
useHtmlIndividualConfiguration();
group('supported', () {
test('supported', () {
expect(ApplicationCache.supported, true);
});
});
group('ApplicationCache', () {
test('ApplicationCache', () {
var expectation = ApplicationCache.supported ? returnsNormally : throws;
expect(() {
ApplicationCache appCache = window.applicationCache;
expect(cacheStatusToString(appCache.status), "UNCACHED");
}, expectation);
});
});
}
String cacheStatusToString(int status) {
switch (status) {
case ApplicationCache.UNCACHED: // UNCACHED == 0
return 'UNCACHED';
case ApplicationCache.IDLE: // IDLE == 1
return 'IDLE';
case ApplicationCache.CHECKING: // CHECKING == 2
return 'CHECKING';
case ApplicationCache.DOWNLOADING: // DOWNLOADING == 3
return 'DOWNLOADING';
case ApplicationCache.UPDATEREADY: // UPDATEREADY == 4
return 'UPDATEREADY';
case ApplicationCache.OBSOLETE: // OBSOLETE == 5
return 'OBSOLETE';
default:
return 'UNKNOWN CACHE STATUS';
}
;
}