| 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 const String DB_NAME = 'Test'; | 9 const String DB_NAME = 'Test'; |
| 10 const String STORE_NAME = 'TEST'; | 10 const String STORE_NAME = 'TEST'; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 db.close(); | 88 db.close(); |
| 89 expect(object, matcher); | 89 expect(object, matcher); |
| 90 }).whenComplete(() { | 90 }).whenComplete(() { |
| 91 if (db != null) { | 91 if (db != null) { |
| 92 db.close(); | 92 db.close(); |
| 93 } | 93 } |
| 94 }); | 94 }); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 tests_dynamic() { | 97 tests_dynamic() { |
| 98 futureTest('test1', testReadWrite(123, 'Hoot!', equals('Hoot!'))); | 98 test('test1', testReadWrite(123, 'Hoot!', equals('Hoot!'))); |
| 99 futureTest('test2', testReadWrite(123, 12345, equals(12345))); | 99 test('test2', testReadWrite(123, 12345, equals(12345))); |
| 100 futureTest('test3', testReadWrite(123, [1, 2, 3], equals([1, 2, 3]))); | 100 test('test3', testReadWrite(123, [1, 2, 3], equals([1, 2, 3]))); |
| 101 futureTest('test4', testReadWrite(123, [2, 3, 4], equals([2, 3, 4]))); | 101 test('test4', testReadWrite(123, [2, 3, 4], equals([2, 3, 4]))); |
| 102 futureTest('test4', testReadWrite(123, false, equals(false))); | 102 test('test4', testReadWrite(123, false, equals(false))); |
| 103 } | 103 } |
| 104 | 104 |
| 105 tests_typed() { | 105 tests_typed() { |
| 106 futureTest('test1', testReadWriteTyped(123, 'Hoot!', equals('Hoot!'))); | 106 test('test1', testReadWriteTyped(123, 'Hoot!', equals('Hoot!'))); |
| 107 futureTest('test2', testReadWriteTyped(123, 12345, equals(12345))); | 107 test('test2', testReadWriteTyped(123, 12345, equals(12345))); |
| 108 futureTest('test3', testReadWriteTyped(123, [1, 2, 3], equals([1, 2, 3]))); | 108 test('test3', testReadWriteTyped(123, [1, 2, 3], equals([1, 2, 3]))); |
| 109 futureTest('test4', testReadWriteTyped(123, [2, 3, 4], equals([2, 3, 4]))); | 109 test('test4', testReadWriteTyped(123, [2, 3, 4], equals([2, 3, 4]))); |
| 110 futureTest('test4', testReadWriteTyped(123, false, equals(false))); | 110 test('test4', testReadWriteTyped(123, false, equals(false))); |
| 111 } | 111 } |
| 112 | 112 |
| 113 main() { | 113 main() { |
| 114 useHtmlIndividualConfiguration(); | 114 useHtmlIndividualConfiguration(); |
| 115 | 115 |
| 116 // Test that indexed_db is properly flagged as supported or not. | 116 // Test that indexed_db is properly flagged as supported or not. |
| 117 // Note that the rest of the indexed_db tests assume that this has been | 117 // Note that the rest of the indexed_db tests assume that this has been |
| 118 // checked. | 118 // checked. |
| 119 group('supported', () { | 119 group('supported', () { |
| 120 test('supported', () { | 120 test('supported', () { |
| 121 expect(idb.IdbFactory.supported, true); | 121 expect(idb.IdbFactory.supported, true); |
| 122 }); | 122 }); |
| 123 }); | 123 }); |
| 124 | 124 |
| 125 group('functional', () { | 125 group('functional', () { |
| 126 test('throws when unsupported', () { | 126 test('throws when unsupported', () { |
| 127 var expectation = idb.IdbFactory.supported ? returnsNormally : throws; | 127 var expectation = idb.IdbFactory.supported ? returnsNormally : throws; |
| 128 | 128 |
| 129 expect(() { | 129 expect(() { |
| 130 var db = html.window.indexedDB; | 130 var db = html.window.indexedDB; |
| 131 db.open('random_db'); | 131 db.open('random_db'); |
| 132 }, expectation); | 132 }, expectation); |
| 133 }); | 133 }); |
| 134 | 134 |
| 135 // Don't bother with these tests if it's unsupported. | 135 // Don't bother with these tests if it's unsupported. |
| 136 if (idb.IdbFactory.supported) { | 136 if (idb.IdbFactory.supported) { |
| 137 futureTest('upgrade', testUpgrade); | 137 test('upgrade', testUpgrade); |
| 138 tests_dynamic(); | 138 tests_dynamic(); |
| 139 tests_typed(); | 139 tests_typed(); |
| 140 } | 140 } |
| 141 }); | 141 }); |
| 142 } | 142 } |
| OLD | NEW |