| 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' as html; | 4 import 'dart:html' as html; |
| 5 import 'dart:indexed_db' as idb; | 5 import 'dart:indexed_db' as idb; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'utils.dart'; | 7 import 'utils.dart'; |
| 8 | 8 |
| 9 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. | 9 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 throw new Exception('IndexedDB failure'); | 23 throw new Exception('IndexedDB failure'); |
| 24 }); | 24 }); |
| 25 } | 25 } |
| 26 | 26 |
| 27 createObjectStore(db) { | 27 createObjectStore(db) { |
| 28 var store = db.createObjectStore(storeName); | 28 var store = db.createObjectStore(storeName); |
| 29 expect(store, isNotNull); | 29 expect(store, isNotNull); |
| 30 } | 30 } |
| 31 | 31 |
| 32 step2(e) { | 32 step2(e) { |
| 33 var transaction = db.transaction(storeName, mode : 'readonly'); | 33 var transaction = db.transaction(storeName, 'readonly'); |
| 34 var request = transaction.objectStore(storeName).getObject(key); | 34 var request = transaction.objectStore(storeName).getObject(key); |
| 35 request.onSuccess.listen(expectAsync1((e) { | 35 request.onSuccess.listen(expectAsync1((e) { |
| 36 var object = e.target.result; | 36 var object = e.target.result; |
| 37 db.close(); | 37 db.close(); |
| 38 check(value, object); | 38 check(value, object); |
| 39 })); | 39 })); |
| 40 request.onError.listen(fail); | 40 request.onError.listen(fail); |
| 41 } | 41 } |
| 42 | 42 |
| 43 step1() { | 43 step1() { |
| 44 var transaction = db.transaction([storeName], mode : 'readwrite'); | 44 var transaction = db.transaction([storeName], 'readwrite'); |
| 45 var request = transaction.objectStore(storeName).put(value, key); | 45 var request = transaction.objectStore(storeName).put(value, key); |
| 46 request.onSuccess.listen(expectAsync1(step2)); | 46 request.onSuccess.listen(expectAsync1(step2)); |
| 47 request.onError.listen(fail); | 47 request.onError.listen(fail); |
| 48 } | 48 } |
| 49 | 49 |
| 50 initDb(e) { | 50 initDb(e) { |
| 51 db = e.target.result; | 51 db = e.target.result; |
| 52 if (version != db.version) { | 52 if (version != db.version) { |
| 53 // Legacy 'setVersion' upgrade protocol. | 53 // Legacy 'setVersion' upgrade protocol. |
| 54 var request = db.setVersion('$version'); | 54 var request = db.setVersion('$version'); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 go('test_DAG', obj2); | 129 go('test_DAG', obj2); |
| 130 go('test_cycle', obj3); | 130 go('test_cycle', obj3); |
| 131 go('test_simple_splay', obj4); | 131 go('test_simple_splay', obj4); |
| 132 go('const_array_1', const [const [1], const [2]]); | 132 go('const_array_1', const [const [1], const [2]]); |
| 133 go('const_array_dag', const [const [1], const [1]]); | 133 go('const_array_dag', const [const [1], const [1]]); |
| 134 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); | 134 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); |
| 135 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); | 135 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); |
| 136 go('cyclic_list', cyclic_list); | 136 go('cyclic_list', cyclic_list); |
| 137 } | 137 } |
| 138 } | 138 } |
| OLD | NEW |