mirror of
https://github.com/servo/servo.git
synced 2025-09-08 14:08:22 +01:00
Update web-platform-tests to revision a46616a5b18e83587ddbbed756c7b96cbb4b015d
This commit is contained in:
parent
3f07cfec7c
commit
578498ba24
4001 changed files with 159517 additions and 30260 deletions
|
@ -2,25 +2,14 @@
|
|||
<title>IndexedDB: Test IDBObjectStore.getAllKeys.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support.js"></script>
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
|
||||
var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
|
||||
|
||||
function doSetup(dbName, dbVersion, onsuccess) {
|
||||
var delete_request = indexedDB.deleteDatabase(dbName);
|
||||
delete_request.onerror = function() {
|
||||
assert_unreached('deleteDatabase should not fail');
|
||||
};
|
||||
delete_request.onsuccess = function(e) {
|
||||
var req = indexedDB.open(dbName, dbVersion);
|
||||
req.onsuccess = onsuccess;
|
||||
req.onerror = function() {
|
||||
assert_unreached('open should not fail');
|
||||
};
|
||||
req.onupgradeneeded = function(evt) {
|
||||
var connection = evt.target.result;
|
||||
|
||||
function getall_test(func, name) {
|
||||
indexeddb_test(
|
||||
function(t, connection, tx) {
|
||||
var store = connection.createObjectStore('generated',
|
||||
{autoIncrement: true, keyPath: 'id'});
|
||||
alphabet.forEach(function(letter) {
|
||||
|
@ -33,8 +22,10 @@ function doSetup(dbName, dbVersion, onsuccess) {
|
|||
});
|
||||
|
||||
store = connection.createObjectStore('empty', null);
|
||||
};
|
||||
};
|
||||
},
|
||||
func,
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
function createGetAllKeysRequest(t, storeName, connection, range, maxCount) {
|
||||
|
@ -45,9 +36,7 @@ function createGetAllKeysRequest(t, storeName, connection, range, maxCount) {
|
|||
return req;
|
||||
}
|
||||
|
||||
doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
||||
var connection = evt.target.result;
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection, 'c');
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
assert_array_equals(evt.target.result, ['c']);
|
||||
|
@ -55,7 +44,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Single item get');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'generated', connection, 3);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
var data = evt.target.result;
|
||||
|
@ -65,7 +54,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Single item get (generated key)');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'empty', connection);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
assert_array_equals(evt.target.result, [],
|
||||
|
@ -75,7 +64,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'getAllKeys on empty object store');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
assert_array_equals(evt.target.result, alphabet);
|
||||
|
@ -83,7 +72,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get all values');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined,
|
||||
10);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -92,7 +81,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Test maxCount');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection,
|
||||
IDBKeyRange.bound('g', 'm'));
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -101,7 +90,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get bound range');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection,
|
||||
IDBKeyRange.bound('g', 'm'), 3);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -110,7 +99,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get bound range with maxCount');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection,
|
||||
IDBKeyRange.bound('g', 'k', false, true));
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -119,7 +108,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get upper excluded');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection,
|
||||
IDBKeyRange.bound('g', 'k', true, false));
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -128,7 +117,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get lower excluded');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'generated', connection,
|
||||
IDBKeyRange.bound(4, 15), 3);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -139,7 +128,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'Get bound range (generated) with maxCount');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection,
|
||||
"Doesn't exist");
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -151,7 +140,7 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
req.onerror = t.unreached_func('getAllKeys request should succeed');
|
||||
}, 'Non existent key');
|
||||
|
||||
async_test(function(t) {
|
||||
getall_test(function(t, connection) {
|
||||
var req = createGetAllKeysRequest(t, 'out-of-line', connection, undefined,
|
||||
0);
|
||||
req.onsuccess = t.step_func(function(evt) {
|
||||
|
@ -160,8 +149,4 @@ doSetup(location.pathname + '-IDBObjectStore.getAllKeys', 1, function(evt) {
|
|||
});
|
||||
}, 'zero maxCount');
|
||||
|
||||
// Explicit done needed in case async_test body fails synchronously.
|
||||
done();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue