diff --git a/testing/web-platform/tests/shared-storage/resources/simple-module.js b/testing/web-platform/tests/shared-storage/resources/simple-module.js index 80689e5f9d3f..4bd7085256e1 100644 --- a/testing/web-platform/tests/shared-storage/resources/simple-module.js +++ b/testing/web-platform/tests/shared-storage/resources/simple-module.js @@ -155,6 +155,20 @@ class AppendWithLockOptionOperation { } } +class BatchUpdateWithTwoAppendMethodsWithBatchLockOptionOperation { + async run(urls, data) { + if (data && data.hasOwnProperty('key') && data.hasOwnProperty('lock_name') + && data.hasOwnProperty('append_letter')) { + sharedStorage.batchUpdate([ + new SharedStorageAppendMethod(data['key'], data['append_letter']), + new SharedStorageAppendMethod(data['key'], data['append_letter']) + ], {withLock: data['lock_name']}); + return 1; + } + return -1; + } +} + register('test-url-selection-operation', TestURLSelectionOperation); register('test-url-selection-operation-2', TestURLSelectionOperationTwo); register('test-slow-url-selection-operation', TestSlowURLSelectionOperation); @@ -166,3 +180,4 @@ register('verify-interest-groups', VerifyInterestGroups); register('get-wait-increment-within-lock', GetWaitIncrementWithinLockOperation); register('get-wait-set-within-lock', GetWaitSetWithinLockOperation); register('append-with-lock-option', AppendWithLockOptionOperation); +register('batch-update-with-two-append-methods-with-batch-lock-option', BatchUpdateWithTwoAppendMethodsWithBatchLockOptionOperation); diff --git a/testing/web-platform/tests/shared-storage/setters.tentative.https.sub.html b/testing/web-platform/tests/shared-storage/setters.tentative.https.sub.html index 35462f3b2abb..c5380f8dd856 100644 --- a/testing/web-platform/tests/shared-storage/setters.tentative.https.sub.html +++ b/testing/web-platform/tests/shared-storage/setters.tentative.https.sub.html @@ -104,5 +104,22 @@ let a = new SharedStorageClearMethod(); }, 'new SharedStorageClearMethod with no arguments'); +promise_test(() => { + return sharedStorage.batchUpdate([ + new SharedStorageSetMethod("key0", "value0", {withLock: "lock1"}), + new SharedStorageAppendMethod("key1", "value1"), + new SharedStorageDeleteMethod("key2"), + new SharedStorageClearMethod({withLock: "lock2"}) + ], {withLock: "lock3"}); +}, 'sharedStorage.batchUpdate'); + +promise_test(async t => { + return promise_rejects_js(t, TypeError, sharedStorage.batchUpdate()); +}, 'sharedStorage.batchUpdate without \'methods\' argument'); + +promise_test(async t => { + return promise_rejects_js(t, TypeError, sharedStorage.batchUpdate(["123"])); +}, 'sharedStorage.batchUpdate with invalid \'methods\' argument'); + diff --git a/testing/web-platform/tests/shared-storage/web-locks-window-batch-update.tentative.https.sub.html b/testing/web-platform/tests/shared-storage/web-locks-window-batch-update.tentative.https.sub.html new file mode 100644 index 000000000000..cc02f119ecb2 --- /dev/null +++ b/testing/web-platform/tests/shared-storage/web-locks-window-batch-update.tentative.https.sub.html @@ -0,0 +1,74 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/shared-storage/web-locks-worklet-batch-update.tentative.https.sub.html b/testing/web-platform/tests/shared-storage/web-locks-worklet-batch-update.tentative.https.sub.html new file mode 100644 index 000000000000..50a130a04b24 --- /dev/null +++ b/testing/web-platform/tests/shared-storage/web-locks-worklet-batch-update.tentative.https.sub.html @@ -0,0 +1,85 @@ + + + + + + + + + +