OLD | NEW |
1 library WebDBTest; | 1 library WebDBTest; |
2 import 'dart:async'; | 2 import 'dart:async'; |
3 import 'dart:html'; | 3 import 'dart:html'; |
4 import 'dart:web_sql'; | 4 import 'dart:web_sql'; |
5 import '../../pkg/unittest/lib/unittest.dart'; | 5 import '../../pkg/unittest/lib/unittest.dart'; |
6 import '../../pkg/unittest/lib/html_individual_config.dart'; | 6 import '../../pkg/unittest/lib/html_individual_config.dart'; |
7 import 'utils.dart'; | 7 import 'utils.dart'; |
8 | 8 |
9 void fail(message) { | 9 void fail(message) { |
10 guardAsync(() { | 10 guardAsync(() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 test('unsupported throws', () { | 104 test('unsupported throws', () { |
105 var expectation = SqlDatabase.supported ? returnsNormally : throws; | 105 var expectation = SqlDatabase.supported ? returnsNormally : throws; |
106 expect(() { | 106 expect(() { |
107 window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024); | 107 window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024); |
108 }, expectation); | 108 }, expectation); |
109 | 109 |
110 }); | 110 }); |
111 futureTest('Web Database', () { | 111 futureTest('Web Database', () { |
112 // Skip if not supported. | 112 // Skip if not supported. |
113 if (!SqlDatabase.supported) { | 113 if (!SqlDatabase.supported) { |
114 return; | 114 return new Future.immediate(null); |
115 } | 115 } |
116 | 116 |
117 final tableName = 'test_table'; | 117 final tableName = 'test_table'; |
118 final columnName = 'test_data'; | 118 final columnName = 'test_data'; |
119 | 119 |
120 final db = window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024); | 120 final db = window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024); |
121 | 121 |
122 expect(db, isNotNull, reason: 'Unable to open database'); | 122 expect(db, isNotNull, reason: 'Unable to open database'); |
123 | 123 |
124 var tx; | 124 var tx; |
(...skipping 14 matching lines...) Expand all Loading... |
139 var row = resultSet.rows.item(0); | 139 var row = resultSet.rows.item(0); |
140 expect(row.containsKey(columnName), isTrue); | 140 expect(row.containsKey(columnName), isTrue); |
141 expect(row[columnName], 'Some text data'); | 141 expect(row[columnName], 'Some text data'); |
142 expect(resultSet.rows[0], row); | 142 expect(resultSet.rows[0], row); |
143 }).then((_) { | 143 }).then((_) { |
144 return dropTable(tx, tableName); | 144 return dropTable(tx, tableName); |
145 }); | 145 }); |
146 }); | 146 }); |
147 }); | 147 }); |
148 } | 148 } |
OLD | NEW |