OLD | NEW |
1 library IndexedDB1Test; | 1 library IndexedDB1Test; |
2 | 2 |
3 import 'package:unittest/unittest.dart'; | 3 import 'package:unittest/unittest.dart'; |
4 import 'package:unittest/html_individual_config.dart'; | 4 import 'package:unittest/html_individual_config.dart'; |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html' as html; | 6 import 'dart:html' as html; |
7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
8 import 'dart:indexed_db' as idb; | 8 import 'dart:indexed_db' as idb; |
9 | 9 |
10 const String STORE_NAME = 'TEST'; | 10 const String STORE_NAME = 'TEST'; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 // Test that indexed_db is properly flagged as supported or not. | 159 // Test that indexed_db is properly flagged as supported or not. |
160 // Note that the rest of the indexed_db tests assume that this has been | 160 // Note that the rest of the indexed_db tests assume that this has been |
161 // checked. | 161 // checked. |
162 group('supported', () { | 162 group('supported', () { |
163 test('supported', () { | 163 test('supported', () { |
164 expect(idb.IdbFactory.supported, true); | 164 expect(idb.IdbFactory.supported, true); |
165 }); | 165 }); |
166 }); | 166 }); |
167 | 167 |
168 group('supportsDatabaseNames', () { | |
169 test('supported', () { | |
170 expect(html.window.indexedDB.supportsDatabaseNames, isTrue); | |
171 }); | |
172 }); | |
173 | |
174 group('functional', () { | 168 group('functional', () { |
175 test('throws when unsupported', () { | 169 test('throws when unsupported', () { |
176 var expectation = idb.IdbFactory.supported ? returnsNormally : throws; | 170 var expectation = idb.IdbFactory.supported ? returnsNormally : throws; |
177 | 171 |
178 expect(() { | 172 expect(() { |
179 var db = html.window.indexedDB; | 173 var db = html.window.indexedDB; |
180 db.open('random_db'); | 174 db.open('random_db'); |
181 }, expectation); | 175 }, expectation); |
182 }); | 176 }); |
183 | 177 |
184 // Don't bother with these tests if it's unsupported. | 178 // Don't bother with these tests if it's unsupported. |
185 if (idb.IdbFactory.supported) { | 179 if (idb.IdbFactory.supported) { |
186 test('upgrade', testUpgrade); | 180 test('upgrade', testUpgrade); |
187 group('dynamic', () { | 181 group('dynamic', () { |
188 testTypes(testReadWrite); | 182 testTypes(testReadWrite); |
189 }); | 183 }); |
190 group('typed', () { | 184 group('typed', () { |
191 testTypes(testReadWriteTyped); | 185 testTypes(testReadWriteTyped); |
192 }); | 186 }); |
193 } | 187 } |
194 }); | 188 }); |
195 } | 189 } |
OLD | NEW |