OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>IndexedDB: Test IDBIndex.getAllKeys.</title> | 2 <title>IndexedDB: Test IDBIndex.getAllKeys.</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> | 5 <script> |
6 | 6 |
7 var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); | 7 var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); |
8 | 8 |
9 function doSetup(dbName, dbVersion, onsuccess) { | 9 function doSetup(dbName, dbVersion, onsuccess) { |
10 var delete_request = indexedDB.deleteDatabase(dbName); | 10 var delete_request = indexedDB.deleteDatabase(dbName); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 connection, "Doesn't exist"); | 175 connection, "Doesn't exist"); |
176 req.onsuccess = t.step_func(function(evt) { | 176 req.onsuccess = t.step_func(function(evt) { |
177 assert_array_equals(evt.target.result, [], | 177 assert_array_equals(evt.target.result, [], |
178 'getAllKeys() using a nonexistent key should return empty array'); | 178 'getAllKeys() using a nonexistent key should return empty array'); |
179 t.done(); | 179 t.done(); |
180 req.onerror = t.unreached_func('getAllKeys request should succeed'); | 180 req.onerror = t.unreached_func('getAllKeys request should succeed'); |
181 }); | 181 }); |
182 }, 'Non existent key'); | 182 }, 'Non existent key'); |
183 | 183 |
184 async_test(function(t) { | 184 async_test(function(t) { |
185 var transaction = connection.transaction('out-of-line', 'readonly'); | 185 var req = createGetAllKeysRequest(t, 'out-of-line', connection, |
186 var store = transaction.objectStore('out-of-line'); | 186 undefined, 0); |
187 var index = store.index('test_idx'); | 187 req.onsuccess = t.step_func(function(evt) { |
188 assert_throws(new TypeError(), function () { | 188 assert_array_equals(evt.target.result, alphabet, |
189 index.getAllKeys(undefined, 0); | 189 'getAllKeys() should return a..z'); |
190 }, 'getAllKeys() with maxCount=0 should throw TypeError'); | 190 t.done(); |
191 t.done(); | 191 }); |
192 }, 'maxCount=0'); | 192 }, 'maxCount=0'); |
193 | 193 |
194 async_test(function(t) { | 194 async_test(function(t) { |
195 var req = createGetAllKeysRequest(t, 'out-of-line-multi', connection, | 195 var req = createGetAllKeysRequest(t, 'out-of-line-multi', connection, |
196 'vowel'); | 196 'vowel'); |
197 req.onsuccess = t.step_func(function(evt) { | 197 req.onsuccess = t.step_func(function(evt) { |
198 assert_array_equals(evt.target.result, ['A','E','I','O','U']) | 198 assert_array_equals(evt.target.result, ['A','E','I','O','U']) |
199 t.done(); | 199 t.done(); |
200 }); | 200 }); |
201 req.onerror = t.unreached_func('getAllKeys request should succeed'); | 201 req.onerror = t.unreached_func('getAllKeys request should succeed'); |
202 }, 'Retrieve multiEntry keys'); | 202 }, 'Retrieve multiEntry keys'); |
203 }); | 203 }); |
204 | 204 |
205 </script> | 205 </script> |
OLD | NEW |