diff options
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html')
-rw-r--r-- | testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html | 61 |
1 files changed, 61 insertions, 0 deletions
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 0000000000..dc324b22d6 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-addmodule-resolution.https.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html> + <head> + <title> + Test the invocation order of AudioWorklet.addModule() and BaseAudioContext + </title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/webaudio/resources/audit.js"></script> + </head> + <body> + <script id="layout-test-code"> + let audit = Audit.createTaskRunner(); + + setup(() => { + let sampleRate = 48000; + let realtimeContext = new AudioContext(); + let offlineContext = new OfflineAudioContext(1, sampleRate, sampleRate); + + let filePath = 'processors/dummy-processor.js'; + + // Test if the browser does not crash upon addModule() call after the + // realtime context construction. + audit.define( + {label: 'module-loading-after-realtime-context-creation'}, + (task, should) => { + let dummyWorkletNode = + new AudioWorkletNode(realtimeContext, 'dummy'); + dummyWorkletNode.connect(realtimeContext.destination); + should(dummyWorkletNode instanceof AudioWorkletNode, + '"dummyWorkletNode" is an instance of AudioWorkletNode ' + + 'from realtime context') + .beTrue(); + task.done(); + }); + + // Test if the browser does not crash upon addModule() call after the + // offline context construction. + audit.define( + {label: 'module-loading-after-offline-context-creation'}, + (task, should) => { + let dummyWorkletNode = + new AudioWorkletNode(offlineContext, 'dummy'); + dummyWorkletNode.connect(offlineContext.destination); + should(dummyWorkletNode instanceof AudioWorkletNode, + '"dummyWorkletNode" is an instance of AudioWorkletNode ' + + 'from offline context') + .beTrue(); + task.done(); + }); + + Promise.all([ + realtimeContext.audioWorklet.addModule(filePath), + offlineContext.audioWorklet.addModule(filePath) + ]).then(() => { + audit.run(); + }); + }); + </script> + </body> +</html> |