| 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:async'; | 4 import 'dart:async'; |
| 5 import 'dart:html' as html; | 5 import 'dart:html' as html; |
| 6 import 'dart:indexed_db' as idb; | 6 import 'dart:indexed_db' as idb; |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'utils.dart'; | 8 import 'utils.dart'; |
| 9 | 9 |
| 10 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. | 10 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 expect(store, isNotNull); | 21 expect(store, isNotNull); |
| 22 } | 22 } |
| 23 | 23 |
| 24 var db; | 24 var db; |
| 25 // Delete any existing DBs. | 25 // Delete any existing DBs. |
| 26 return html.window.indexedDB.deleteDatabase(dbName).then((_) { | 26 return html.window.indexedDB.deleteDatabase(dbName).then((_) { |
| 27 return html.window.indexedDB.open(dbName, version: version, | 27 return html.window.indexedDB.open(dbName, version: version, |
| 28 onUpgradeNeeded: createObjectStore); | 28 onUpgradeNeeded: createObjectStore); |
| 29 }).then((result) { | 29 }).then((result) { |
| 30 db = result; | 30 db = result; |
| 31 var transaction = db.transaction([storeName], 'readwrite'); | 31 var transaction = db.transactionList([storeName], 'readwrite'); |
| 32 transaction.objectStore(storeName).put(value, key); | 32 transaction.objectStore(storeName).put(value, key); |
| 33 | 33 |
| 34 return transaction.completed; | 34 return transaction.completed; |
| 35 }).then((db) { | 35 }).then((db) { |
| 36 var transaction = db.transaction(storeName, 'readonly'); | 36 var transaction = db.transaction(storeName, 'readonly'); |
| 37 return transaction.objectStore(storeName).getObject(key); | 37 return transaction.objectStore(storeName).getObject(key); |
| 38 }).then((object) { | 38 }).then((object) { |
| 39 db.close(); | 39 db.close(); |
| 40 check(value, object); | 40 check(value, object); |
| 41 }).catchError((e) { | 41 }).catchError((e) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 go('test_DAG', obj2); | 88 go('test_DAG', obj2); |
| 89 go('test_cycle', obj3); | 89 go('test_cycle', obj3); |
| 90 go('test_simple_splay', obj4); | 90 go('test_simple_splay', obj4); |
| 91 go('const_array_1', const [const [1], const [2]]); | 91 go('const_array_1', const [const [1], const [2]]); |
| 92 go('const_array_dag', const [const [1], const [1]]); | 92 go('const_array_dag', const [const [1], const [1]]); |
| 93 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); | 93 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); |
| 94 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); | 94 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); |
| 95 go('cyclic_list', cyclic_list); | 95 go('cyclic_list', cyclic_list); |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |