| 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_individual_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_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 'utils.dart'; | 7 import 'utils.dart'; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 useHtmlIndividualConfiguration(); | 10 useHtmlIndividualConfiguration(); |
| 11 if (!idb.IdbFactory.supported) { | |
| 12 return; | |
| 13 } | |
| 14 | 11 |
| 15 group('supportsDatabaseNames', () { | 12 group('supportsDatabaseNames', () { |
| 16 test('supported', () { | 13 test('supported', () { |
| 17 expect(html.window.indexedDB.supportsDatabaseNames, isTrue); | 14 expect(html.window.indexedDB.supportsDatabaseNames, isTrue); |
| 18 }); | 15 }); |
| 19 }); | 16 }); |
| 20 | 17 |
| 18 if (!idb.IdbFactory.supported) { |
| 19 return; |
| 20 } |
| 21 |
| 21 group('functional', () { | 22 group('functional', () { |
| 22 var dbName = 'test_db'; | 23 var dbName = 'test_db'; |
| 23 var storeName = 'test_store'; | 24 var storeName = 'test_store'; |
| 24 var indexName = 'name_index'; | 25 var indexName = 'name_index'; |
| 25 var db; | 26 var db; |
| 26 | 27 |
| 27 futureTest('init', () { | 28 futureTest('init', () { |
| 28 return html.window.indexedDB.deleteDatabase(dbName).then((_) { | 29 return html.window.indexedDB.deleteDatabase(dbName).then((_) { |
| 29 return html.window.indexedDB.open(dbName, version: 1, | 30 return html.window.indexedDB.open(dbName, version: 1, |
| 30 onUpgradeNeeded: (e) { | 31 onUpgradeNeeded: (e) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 transaction = db.transaction([storeName], 'readonly'); | 183 transaction = db.transaction([storeName], 'readonly'); |
| 183 var index = transaction.objectStore(storeName).index(indexName); | 184 var index = transaction.objectStore(storeName).index(indexName); |
| 184 return index.get('two'); | 185 return index.get('two'); |
| 185 }).then((readValue) { | 186 }).then((readValue) { |
| 186 expect(readValue, isNull); | 187 expect(readValue, isNull); |
| 187 return transaction.completed; | 188 return transaction.completed; |
| 188 }); | 189 }); |
| 189 }); | 190 }); |
| 190 }); | 191 }); |
| 191 } | 192 } |
| OLD | NEW |