From 1fd3eec3eae38600a2d20a0acf0faee9e3ab3bce Mon Sep 17 00:00:00 2001 From: Hongchan Choi Date: Mon, 26 Mar 2018 15:17:43 +0000 Subject: [PATCH] Bug 1443628 [wpt PR 9883] - Upstream AudioWorklet tests to WPT suite, a=testonly Automatic update from web-platform-testsUpstream AudioWorklet tests to WPT suite 1. Tests moved: From - src/third_party/WebKit/LayoutTests/http/tests/webaudio/audio-worklet/ to - src/third_party/WebKit/LayoutTests/external/wpt/webaudio/ 2. All tests were renamed because of the SecureContext requirement. 3. Updated the script paths. 4. Used a variable for the processor script path. Bug: 817869 Test: All existing tests are passing after updating paths. Change-Id: I7bd6c91c365730e453205f2241cb45986e2c7d3b Reviewed-on: https://chromium-review.googlesource.com/944847 Reviewed-by: Raymond Toy Reviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/master@{#541281} wpt-commits: a075d92a0c9a272c4140ab66a94db93aa630e355 wpt-pr: 9883 wpt-commits: a075d92a0c9a272c4140ab66a94db93aa630e355 wpt-pr: 9883 --- testing/web-platform/meta/MANIFEST.json | 173 ++++++++++++++++++ ...dioworklet-addmodule-resolution.https.html | 59 ++++++ .../audioworklet-audioparam.https.html | 85 +++++++++ .../audioworklet-messageport.https.html | 66 +++++++ ...oworkletglobalscope-sample-rate.https.html | 42 +++++ ...oworkletglobalscope-timing-info.https.html | 57 ++++++ .../audioworkletnode-channel-count.https.html | 77 ++++++++ .../audioworkletnode-construction.https.html | 53 ++++++ ...workletnode-constructor-options.https.html | 149 +++++++++++++++ .../audioworkletnode-onerror.https.html | 55 ++++++ .../audioworkletprocessor-options.https.html | 77 ++++++++ .../baseaudiocontext-audioworklet.https.html | 30 +++ .../processors/dummy-processor.js | 18 ++ .../processors/error-processor.js | 33 ++++ .../processors/gain-processor.js | 33 ++++ .../processors/one-pole-processor.js | 49 +++++ .../processors/option-test-processor.js | 19 ++ .../processors/port-processor.js | 29 +++ .../processors/timing-info-processor.js | 25 +++ 19 files changed, 1129 insertions(+) create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js create mode 100644 testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index eae0bbdd35a2..7aa65df6440c 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -294373,6 +294373,41 @@ {} ] ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js": [ + [ + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js": [ + [ + {} + ] + ], "webaudio/the-audio-api/the-biquadfilternode-interface/.gitkeep": [ [ {} @@ -363480,6 +363515,72 @@ {} ] ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html", + {} + ] + ], + "webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html": [ + [ + "/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html", + {} + ] + ], "webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html": [ [ "/webaudio/the-audio-api/the-constantsourcenode-interface/constant-source-basic.html", @@ -599253,6 +599354,78 @@ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html": [ + "d8f2e2d2f6592718f329c1727b63d69035965973", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html": [ + "de9ecb9c7d9a65052a7a795b0f13c73ed31dbe7b", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html": [ + "e14996a4d8cd2765d9b78b7ec6d4350dc54bb8da", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html": [ + "8228071abd6c36908a8b31372185dc0f2dfcdd0a", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html": [ + "ef7c004225bbb5e6d289a990191b22e2faeabcf3", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html": [ + "b6701142fd660a6a29fbfc68cb530b70817b3a44", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html": [ + "b2513b4b5f37b906250b4e1f78eaec80bdc41ef6", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html": [ + "99284ab790c09dd7a23a6fa5022e8b08b9e3947d", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html": [ + "a1cd969fe32a5aca7cd90d0d0955132fd1660b9c", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html": [ + "b70c4e78f5b816a5af789660285ceb91f5dddbfa", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html": [ + "526bcd8fd99ea61564432ca3026a2b6a0b7315b9", + "testharness" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js": [ + "6c985b8281cc9aa25eb61fdb436e6cc36f48bb5b", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js": [ + "0859e9f7bbaf00853f85bbb0e2d6eb4db85578b3", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js": [ + "1561b9eede1ee15126fdd9674a6d9d63194b66c2", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js": [ + "80b817db4e8d3f49e4f5fe6e97f8e687d16f3159", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js": [ + "c2f028c2be836cad2c38a71f96246f84c04323a5", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js": [ + "47092e4372a196e47612388602b6a3876deb653a", + "support" + ], + "webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js": [ + "c93a76f097b441aaec052516256cc922089b4b75", + "support" + ], "webaudio/the-audio-api/the-biquadfilternode-interface/.gitkeep": [ "da39a3ee5e6b4b0d3255bfef95601890afd80709", "support" diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html new file mode 100644 index 000000000000..e94621296a31 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html @@ -0,0 +1,59 @@ + + + + + Test the invocation order of AudioWorklet.addModule() and BaseAudioContext + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html new file mode 100644 index 000000000000..8e51470f646f --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-audioparam.https.html @@ -0,0 +1,85 @@ + + + + + Test AudioWorkletNode's basic AudioParam features + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html new file mode 100644 index 000000000000..546bd1d0d0e3 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html @@ -0,0 +1,66 @@ + + + + + Test MessagePort in AudioWorkletNode and AudioWorkletProcessor + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html new file mode 100644 index 000000000000..d87e35b571d7 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-sample-rate.https.html @@ -0,0 +1,42 @@ + + + + + Test sampleRate in AudioWorkletGlobalScope + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html new file mode 100644 index 000000000000..79d402c51862 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html @@ -0,0 +1,57 @@ + + + + + Test currentTime and currentFrame in AudioWorkletGlobalScope + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html new file mode 100644 index 000000000000..11c237f19dd9 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-channel-count.https.html @@ -0,0 +1,77 @@ + + + + + Test AudioWorkletNode's dynamic channel count feature + + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html new file mode 100644 index 000000000000..7cfd423c071b --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-construction.https.html @@ -0,0 +1,53 @@ + + + + + Test the construction of AudioWorkletNode with real-time context + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html new file mode 100644 index 000000000000..254c07e93228 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-constructor-options.https.html @@ -0,0 +1,149 @@ + + + + + Test of AudioWorkletNodeOptions + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html new file mode 100644 index 000000000000..0a9966add85c --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html @@ -0,0 +1,55 @@ + + + + + Test onprocessorerror handler in AudioWorkletNode + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html new file mode 100644 index 000000000000..ea840ed11ad5 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html @@ -0,0 +1,77 @@ + + + + + Test cross-thread passing of AudioWorkletNodeOptions + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html new file mode 100644 index 000000000000..4281f56379bb --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/baseaudiocontext-audioworklet.https.html @@ -0,0 +1,30 @@ + + + + + Checking BaseAudioContext.audioWorklet + + + + + + + + + diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js new file mode 100644 index 000000000000..11155d508c51 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor.js @@ -0,0 +1,18 @@ +/** + * @class DummyProcessor + * @extends AudioWorkletProcessor + * + * This processor class demonstrates the bare-bone structure of the processor. + */ +class DummyProcessor extends AudioWorkletProcessor { + constructor() { + super(); + } + + process(inputs, outputs, parameters) { + // Doesn't do anything here. + return true; + } +} + +registerProcessor('dummy', DummyProcessor); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js new file mode 100644 index 000000000000..3b010db4f221 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/error-processor.js @@ -0,0 +1,33 @@ +/** + * @class ConstructorErrorProcessor + * @extends AudioWorkletProcessor + */ +class ConstructorErrorProcessor extends AudioWorkletProcessor { + constructor() { + throw 'ConstructorErrorProcessor: an error thrown from constructor.'; + } + + process() { + return true; + } +} + + +/** + * @class ProcessErrorProcessor + * @extends AudioWorkletProcessor + */ +class ProcessErrorProcessor extends AudioWorkletProcessor { + constructor() { + super(); + } + + process() { + throw 'ProcessErrorProcessor: an error throw from process method.'; + return true; + } +} + + +registerProcessor('constructor-error', ConstructorErrorProcessor); +registerProcessor('process-error', ProcessErrorProcessor); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js new file mode 100644 index 000000000000..f5143b3ecc2c --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/gain-processor.js @@ -0,0 +1,33 @@ +/** + * @class GainProcessor + * @extends AudioWorkletProcessor + * + * This processor class demonstrates the bare-bone structure of the processor. + */ +class GainProcessor extends AudioWorkletProcessor { + static get parameterDescriptors() { + return [ + {name: 'gain', defaultValue: 0.707} + ]; + } + + constructor() { + super(); + } + + process(inputs, outputs, parameters) { + let input = inputs[0]; + let output = outputs[0]; + let gain = parameters.gain; + for (let channel = 0; channel < input.length; ++channel) { + let inputChannel = input[channel]; + let outputChannel = output[channel]; + for (let i = 0; i < inputChannel.length; ++i) + outputChannel[i] = inputChannel[i] * gain[i]; + } + + return true; + } +} + +registerProcessor('gain', GainProcessor); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js new file mode 100644 index 000000000000..0bcc43f6f085 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/one-pole-processor.js @@ -0,0 +1,49 @@ +/** + * @class OnePoleFilter + * @extends AudioWorkletProcessor + * + * A simple One-pole filter. + */ + +class OnePoleFilter extends AudioWorkletProcessor { + + // This gets evaluated as soon as the global scope is created. + static get parameterDescriptors() { + return [{ + name: 'frequency', + defaultValue: 250, + minValue: 0, + maxValue: 0.5 * sampleRate + }]; + } + + constructor() { + super(); + this.updateCoefficientsWithFrequency_(250); + } + + updateCoefficientsWithFrequency_(frequency) { + this.b1_ = Math.exp(-2 * Math.PI * frequency / sampleRate); + this.a0_ = 1.0 - this.b1_; + this.z1_ = 0; + } + + process(inputs, outputs, parameters) { + let input = inputs[0]; + let output = outputs[0]; + let frequency = parameters.frequency; + for (let channel = 0; channel < output.length; ++channel) { + let inputChannel = input[channel]; + let outputChannel = output[channel]; + for (let i = 0; i < outputChannel.length; ++i) { + this.updateCoefficientsWithFrequency_(frequency[i]); + this.z1_ = inputChannel[i] * this.a0_ + this.z1_ * this.b1_; + outputChannel[i] = this.z1_; + } + } + + return true; + } +} + +registerProcessor('one-pole-filter', OnePoleFilter); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js new file mode 100644 index 000000000000..27e1da632520 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/option-test-processor.js @@ -0,0 +1,19 @@ +/** + * @class OptionTestProcessor + * @extends AudioWorkletProcessor + * + * This processor class demonstrates the option passing feature by echoing the + * received |nodeOptions| back to the node. + */ +class OptionTestProcessor extends AudioWorkletProcessor { + constructor(nodeOptions) { + super(); + this.port.postMessage(nodeOptions); + } + + process() { + return true; + } +} + +registerProcessor('option-test-processor', OptionTestProcessor); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js new file mode 100644 index 000000000000..5a8baf03372d --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/port-processor.js @@ -0,0 +1,29 @@ +/** + * @class PortProcessor + * @extends AudioWorkletProcessor + * + * This processor class demonstrates the message port functionality. + */ +class PortProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.port.onmessage = this.handleMessage.bind(this); + this.port.postMessage({ + state: 'created', + timeStamp: currentTime + }); + } + + handleMessage(event) { + this.port.postMessage({ + message: event.data, + timeStamp: currentTime + }); + } + + process() { + return true; + } +} + +registerProcessor('port-processor', PortProcessor); diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js new file mode 100644 index 000000000000..714e32dbb5c1 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/processors/timing-info-processor.js @@ -0,0 +1,25 @@ +/** + * @class TimingInfoProcessor + * @extends AudioWorkletProcessor + * + * This processor class is to test the timing information in AWGS. + */ +class TimingInfoProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.port.onmessage = this.echoMessage.bind(this); + } + + echoMessage(event) { + this.port.postMessage({ + currentTime: currentTime, + currentFrame: currentFrame + }); + } + + process() { + return true; + } +} + +registerProcessor('timing-info-processor', TimingInfoProcessor);