| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBTransaction.objectStoreNames attribute</title> | 2 <title>IndexedDB: IDBTransaction.objectStoreNames attribute</title> |
| 3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
| 4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <script src="support.js"></script> |
| 5 <script> | 6 <script> |
| 6 | 7 |
| 7 function indexeddb_test(upgrade_func, open_func, description) { | |
| 8 async_test(function(t) { | |
| 9 var dbname = document.location + '-' + t.name; | |
| 10 var del = indexedDB.deleteDatabase(dbname); | |
| 11 del.onerror = t.unreached_func('deleteDatabase should succeed'); | |
| 12 var open = indexedDB.open(dbname, 1); | |
| 13 open.onerror = t.unreached_func('open should succeed'); | |
| 14 open.onupgradeneeded = t.step_func(function() { | |
| 15 var db = open.result; | |
| 16 var tx = open.transaction; | |
| 17 upgrade_func(t, db, tx); | |
| 18 }); | |
| 19 open.onsuccess = t.step_func(function() { | |
| 20 var db = open.result; | |
| 21 open_func(t, db); | |
| 22 }); | |
| 23 }, description); | |
| 24 } | |
| 25 | |
| 26 function with_stores_test(store_names, open_func, description) { | 8 function with_stores_test(store_names, open_func, description) { |
| 27 indexeddb_test(function(t, db, tx) { | 9 indexeddb_test(function(t, db, tx) { |
| 28 store_names.forEach(function(name) { | 10 store_names.forEach(function(name) { |
| 29 db.createObjectStore(name); | 11 db.createObjectStore(name); |
| 30 }); | 12 }); |
| 31 }, open_func, description); | 13 }, open_func, description); |
| 32 } | 14 } |
| 33 | 15 |
| 34 indexeddb_test(function(t, db, tx) { | 16 indexeddb_test(function(t, db, tx) { |
| 35 assert_array_equals(tx.objectStoreNames, [], | 17 assert_array_equals(tx.objectStoreNames, [], |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 assert_array_equals(tx.objectStoreNames, unusual_names, | 155 assert_array_equals(tx.objectStoreNames, unusual_names, |
| 174 'transaction should have names sorted'); | 156 'transaction should have names sorted'); |
| 175 }, function(t, db) { | 157 }, function(t, db) { |
| 176 var tx = db.transaction(unusual_names.slice().reverse().concat(unusual_names
)); | 158 var tx = db.transaction(unusual_names.slice().reverse().concat(unusual_names
)); |
| 177 assert_array_equals(tx.objectStoreNames, unusual_names, | 159 assert_array_equals(tx.objectStoreNames, unusual_names, |
| 178 'transaction should have names sorted with no duplicates'); | 160 'transaction should have names sorted with no duplicates'); |
| 179 t.done(); | 161 t.done(); |
| 180 }, 'IDBTransaction.objectStoreNames - unusual names'); | 162 }, 'IDBTransaction.objectStoreNames - unusual names'); |
| 181 | 163 |
| 182 </script> | 164 </script> |
| OLD | NEW |