Automatic update from web-platform-tests Make various OPFS WPTs run on more types of workers. Many of the .any.js WPTs did not specify the types of workers are so only ran on dedicated workers. This change adds shared and service to all of those that didn't already specify. There are a couple of tests that start timing out on workers. I am investigating those. Bug: 529228628 Change-Id: I66d9cfd7b1806c010e1b863521d39cc24b61d8eb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8019203 Reviewed-by: Fergal Daly <fergal@chromium.org> Commit-Queue: Mingyu Lei <leimy@chromium.org> Reviewed-by: Mingyu Lei <leimy@chromium.org> Auto-Submit: Fergal Daly <fergal@chromium.org> Cr-Commit-Position: refs/heads/main@{#1654676} -- wpt-commits: cc0f53d38af14c6637c79cabceec9ae29ae63f96 wpt-pr: 60991
57 lines
2.0 KiB
JavaScript
57 lines
2.0 KiB
JavaScript
// META: global=window,worker
|
|
// META: script=resources/test-helpers.js
|
|
// META: script=resources/sandboxed-fs-test-helpers.js
|
|
// META: script=resources/messaging-helpers.js
|
|
// META: script=/IndexedDB/resources/support-promises.js
|
|
|
|
'use strict';
|
|
|
|
directory_test(async (t, root_dir) => {
|
|
const handle = await createFileWithContents('file', 'contents', root_dir);
|
|
|
|
const db = await createDatabase(t, db => {
|
|
db.createObjectStore('store');
|
|
});
|
|
|
|
let tx = db.transaction('store', 'readwrite');
|
|
await promiseForRequest(t, tx.objectStore('store').put(handle, 'key'));
|
|
await promiseForTransaction(t, tx);
|
|
|
|
tx = db.transaction('store', 'readwrite');
|
|
const store = tx.objectStore('store');
|
|
const getRequest = store.get('key');
|
|
await requestWatcher(t, getRequest).wait_for('success');
|
|
|
|
await promiseForRequest(t, store.delete('key'));
|
|
await promiseForTransaction(t, tx);
|
|
|
|
const retrieved = getRequest.result;
|
|
assert_true(await handle.isSameEntry(retrieved));
|
|
const file = await retrieved.getFile();
|
|
assert_equals(await file.text(), 'contents');
|
|
}, 'Reading request.result after the record is deleted still produces a usable handle.');
|
|
|
|
directory_test(async (t, root_dir) => {
|
|
const handle = await createFileWithContents('file', 'contents', root_dir);
|
|
|
|
const db = await createDatabase(t, db => {
|
|
db.createObjectStore('store');
|
|
});
|
|
|
|
const tx = db.transaction('store', 'readwrite');
|
|
await promiseForRequest(t, tx.objectStore('store').put(handle, 'key'));
|
|
await promiseForTransaction(t, tx);
|
|
|
|
const readTx = db.transaction('store', 'readonly');
|
|
const getRequest = readTx.objectStore('store').get('key');
|
|
await requestWatcher(t, getRequest).wait_for('success');
|
|
await promiseForTransaction(t, readTx);
|
|
|
|
db.close();
|
|
|
|
const retrieved = getRequest.result;
|
|
assert_true(await handle.isSameEntry(retrieved));
|
|
const file = await retrieved.getFile();
|
|
assert_equals(await file.text(), 'contents');
|
|
}, 'Reading request.result after the database is closed still produces a usable handle.');
|