OLD | NEW |
1 var databaseName = "database"; | 1 var databaseName = "database"; |
2 var databaseVersion = 1; | 2 var databaseVersion = 1; |
3 | 3 |
4 /* Delete created databases | 4 /* Delete created databases |
5 * | 5 * |
6 * Go through each finished test, see if it has an associated database. Close | 6 * Go through each finished test, see if it has an associated database. Close |
7 * that and delete the database. */ | 7 * that and delete the database. */ |
8 add_completion_callback(function(tests) | 8 add_completion_callback(function(tests) |
9 { | 9 { |
10 for (var i in tests) | 10 for (var i in tests) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 function expect(t, expected) { | 136 function expect(t, expected) { |
137 var results = []; | 137 var results = []; |
138 return result => { | 138 return result => { |
139 results.push(result); | 139 results.push(result); |
140 if (results.length === expected.length) { | 140 if (results.length === expected.length) { |
141 assert_array_equals(results, expected); | 141 assert_array_equals(results, expected); |
142 t.done(); | 142 t.done(); |
143 } | 143 } |
144 }; | 144 }; |
145 } | 145 } |
| 146 |
| 147 // Checks to see if the passed transaction is active (by making |
| 148 // requests against the named store). |
| 149 function is_transaction_active(tx, store_name) { |
| 150 try { |
| 151 const request = tx.objectStore(store_name).get(0); |
| 152 request.onerror = e => { |
| 153 e.preventDefault(); |
| 154 e.stopPropagation(); |
| 155 }; |
| 156 return true; |
| 157 } catch (ex) { |
| 158 assert_equals(ex.name, 'TransactionInactiveError', |
| 159 'Active check should either not throw anything, or throw ' + |
| 160 'TransactionInactiveError'); |
| 161 return false; |
| 162 } |
| 163 } |
OLD | NEW |