| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 var tx = open.transaction; | 121 var tx = open.transaction; |
| 122 upgrade_func(t, db, tx); | 122 upgrade_func(t, db, tx); |
| 123 }); | 123 }); |
| 124 open.onsuccess = t.step_func(function() { | 124 open.onsuccess = t.step_func(function() { |
| 125 var db = open.result; | 125 var db = open.result; |
| 126 if (open_func) | 126 if (open_func) |
| 127 open_func(t, db); | 127 open_func(t, db); |
| 128 }); | 128 }); |
| 129 }, description); | 129 }, description); |
| 130 } | 130 } |
| 131 |
| 132 // Call with a Test and an array of expected results in order. Returns |
| 133 // a function; call the function when a result arrives and when the |
| 134 // expected number appear the order will be asserted and test |
| 135 // completed. |
| 136 function expect(t, expected) { |
| 137 var results = []; |
| 138 return result => { |
| 139 results.push(result); |
| 140 if (results.length === expected.length) { |
| 141 assert_array_equals(results, expected); |
| 142 t.done(); |
| 143 } |
| 144 }; |
| 145 } |
| OLD | NEW |