diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html')
-rw-r--r-- | testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html new file mode 100644 index 0000000000..33627204a6 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html @@ -0,0 +1,53 @@ +<!doctype html> +<html> + <head> + <title> + Test given arrays within AudioWorkletProcessor.process() method + </title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/webaudio/resources/audit.js"></script> + </head> + + <body> + <script> + const audit = Audit.createTaskRunner(); + const filePath = 'processors/array-check-processor.js'; + const context = new AudioContext(); + + // Test if the incoming arrays are frozen as expected. + audit.define('check-frozen-array', (task, should) => { + context.audioWorklet.addModule(filePath).then(() => { + const workletNode = + new AudioWorkletNode(context, 'array-frozen-processor'); + workletNode.port.onmessage = (message) => { + const actual = message.data; + should(actual.isInputFrozen, '|inputs| is frozen').beTrue(); + should(actual.isOutputFrozen, '|outputs| is frozen').beTrue(); + task.done(); + }; + }); + }); + + // The incoming arrays should not be transferred, but the associated + // ArrayBuffers can be transferred. See the `array-transfer-processor` + // definition for the details. + audit.define('transfer-frozen-array', (task, should) => { + const sourceNode = new ConstantSourceNode(context); + const workletNode = + new AudioWorkletNode(context, 'array-transfer-processor'); + workletNode.port.onmessage = (message) => { + const actual = message.data; + if (actual.type === 'assertion') + should(actual.success, actual.message).beTrue(); + if (actual.done) + task.done(); + }; + sourceNode.connect(workletNode); + sourceNode.start(); + }); + + audit.run(); + </script> + </body> +</html> |