| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return this; | 94 return this; |
| 95 } | 95 } |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 return rq_open; | 98 return rq_open; |
| 99 } | 99 } |
| 100 | 100 |
| 101 function assert_key_equals(actual, expected, description) { | 101 function assert_key_equals(actual, expected, description) { |
| 102 assert_equals(indexedDB.cmp(actual, expected), 0, description); | 102 assert_equals(indexedDB.cmp(actual, expected), 0, description); |
| 103 } | 103 } |
| 104 |
| 105 function indexeddb_test(upgrade_func, open_func, description) { |
| 106 async_test(function(t) { |
| 107 var dbname = document.location + '-' + t.name; |
| 108 var del = indexedDB.deleteDatabase(dbname); |
| 109 del.onerror = t.unreached_func('deleteDatabase should succeed'); |
| 110 var open = indexedDB.open(dbname, 1); |
| 111 open.onerror = t.unreached_func('open should succeed'); |
| 112 open.onupgradeneeded = t.step_func(function() { |
| 113 var db = open.result; |
| 114 var tx = open.transaction; |
| 115 upgrade_func(t, db, tx); |
| 116 }); |
| 117 open.onsuccess = t.step_func(function() { |
| 118 var db = open.result; |
| 119 if (open_func) |
| 120 open_func(t, db); |
| 121 }); |
| 122 }, description); |
| 123 } |
| OLD | NEW |