summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
parentInitial commit. (diff)
downloadthunderbird-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-audionode-interface/audionode.html')
-rw-r--r--testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
new file mode 100644
index 0000000000..0b57d27e8e
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/audionode.html
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>
+ audionode.html
+ </title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/webaudio/resources/audit-util.js"></script>
+ <script src="/webaudio/resources/audit.js"></script>
+ </head>
+ <body>
+ <div id="description"></div>
+ <div id="console"></div>
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
+
+ let context = 0;
+ let context2 = 0;
+ let context3 = 0;
+
+ audit.define(
+ {label: 'test', description: 'Basic tests for AudioNode API.'},
+ function(task, should) {
+
+ context = new AudioContext();
+ window.audioNode = context.createBufferSource();
+
+ // Check input and output numbers of AudioSourceNode.
+ should(audioNode.numberOfInputs, 'AudioBufferSource.numberOfInputs')
+ .beEqualTo(0);
+ should(
+ audioNode.numberOfOutputs, 'AudioBufferSource.numberOfOutputs')
+ .beEqualTo(1);
+
+ // Check input and output numbers of AudioDestinationNode
+ should(
+ context.destination.numberOfInputs,
+ 'AudioContext.destination.numberOfInputs')
+ .beEqualTo(1);
+ should(
+ context.destination.numberOfOutputs,
+ 'AudioContext.destination.numberOfOutputs')
+ .beEqualTo(0);
+
+ // Try calling connect() method with illegal values.
+ should(
+ () => audioNode.connect(0, 0, 0), 'audioNode.connect(0, 0, 0)')
+ .throw(TypeError);
+ should(
+ () => audioNode.connect(null, 0, 0),
+ 'audioNode.connect(null, 0, 0)')
+ .throw(TypeError);
+ should(
+ () => audioNode.connect(context.destination, 5, 0),
+ 'audioNode.connect(context.destination, 5, 0)')
+ .throw(DOMException, 'IndexSizeError');
+ should(
+ () => audioNode.connect(context.destination, 0, 5),
+ 'audioNode.connect(context.destination, 0, 5)')
+ .throw(DOMException, 'IndexSizeError');
+
+ should(
+ () => audioNode.connect(context.destination, 0, 0),
+ 'audioNode.connect(context.destination, 0, 0)')
+ .notThrow();
+
+ // Create a new context and try to connect the other context's node
+ // to this one.
+ context2 = new AudioContext();
+ should(
+ () => window.audioNode.connect(context2.destination),
+ 'Connecting a node to a different context')
+ .throw(DOMException, 'InvalidAccessError');
+
+ // 3-arg AudioContext doesn't create an offline context anymore.
+ should(
+ () => context3 = new AudioContext(1, 44100, 44100),
+ 'context3 = new AudioContext(1, 44100, 44100)')
+ .throw(TypeError);
+
+ // Ensure it is an EventTarget
+ should(
+ audioNode instanceof EventTarget, 'AudioNode is an EventTarget')
+ .beTrue();
+
+ task.done();
+ });
+
+ audit.run();
+ </script>
+ </body>
+</html>