OLD | NEW |
1 library IndexedDB1Test; | 1 library IndexedDB1Test; |
2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 import 'dart:collection'; | 5 import 'dart:collection'; |
6 import 'utils.dart'; | 6 import 'utils.dart'; |
7 | 7 |
8 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. | 8 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. |
9 | 9 |
10 const String DB_NAME = 'Test'; | 10 const String DB_NAME = 'Test'; |
11 const String STORE_NAME = 'TEST'; | 11 const String STORE_NAME = 'TEST'; |
12 const int VERSION = 1; | 12 const int VERSION = 1; |
13 | 13 |
14 testReadWrite(key, value, check, | 14 testReadWrite(key, value, check, |
15 [dbName = DB_NAME, | 15 [dbName = DB_NAME, |
16 storeName = STORE_NAME, | 16 storeName = STORE_NAME, |
17 version = VERSION]) => () { | 17 version = VERSION]) => () { |
18 var db; | 18 var db; |
19 | 19 |
20 fail(e) { | 20 fail(e) { |
21 guardAsync(() { | 21 guardAsync(() { |
22 throw const Exception('IndexedDB failure'); | 22 throw new Exception('IndexedDB failure'); |
23 }); | 23 }); |
24 } | 24 } |
25 | 25 |
26 createObjectStore(db) { | 26 createObjectStore(db) { |
27 var store = db.createObjectStore(storeName); | 27 var store = db.createObjectStore(storeName); |
28 expect(store, isNotNull); | 28 expect(store, isNotNull); |
29 } | 29 } |
30 | 30 |
31 step2(e) { | 31 step2(e) { |
32 var transaction = db.transaction(storeName, 'readonly'); | 32 var transaction = db.transaction(storeName, 'readonly'); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 go('test_simple', obj1); | 124 go('test_simple', obj1); |
125 go('test_DAG', obj2); | 125 go('test_DAG', obj2); |
126 go('test_cycle', obj3); | 126 go('test_cycle', obj3); |
127 go('test_simple_splay', obj4); | 127 go('test_simple_splay', obj4); |
128 go('const_array_1', const [const [1], const [2]]); | 128 go('const_array_1', const [const [1], const [2]]); |
129 go('const_array_dag', const [const [1], const [1]]); | 129 go('const_array_dag', const [const [1], const [1]]); |
130 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); | 130 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); |
131 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); | 131 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); |
132 go('cyclic_list', cyclic_list); | 132 go('cyclic_list', cyclic_list); |
133 } | 133 } |
OLD | NEW |