diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html')
-rw-r--r-- | testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html new file mode 100644 index 0000000000..f763d34787 --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<html> + <head> + <title> + Connections and disconnections with different contexts + </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> + <script> + let audit = Audit.createTaskRunner(); + + // Different contexts to be used for testing. + let c1; + let c2; + + audit.define( + {label: 'setup', description: 'Contexts for testing'}, + (task, should) => { + should(() => {c1 = new AudioContext()}, 'c1 = new AudioContext()') + .notThrow(); + should(() => {c2 = new AudioContext()}, 'c2 = new AudioContext()') + .notThrow(); + task.done(); + }); + + audit.define( + {label: 'Test 1', description: 'Connect nodes between contexts'}, + (task, should) => { + let g1; + let g2; + should( + () => {g1 = new GainNode(c1)}, 'Test 1: g1 = new GainNode(c1)') + .notThrow(); + should( + () => {g2 = new GainNode(c2)}, 'Test 1: g2 = new GainNode(c2)') + .notThrow(); + should(() => {g2.connect(g1)}, 'Test 1: g2.connect(g1)') + .throw(DOMException, 'InvalidAccessError'); + task.done(); + }); + + audit.define( + {label: 'Test 2', description: 'Connect AudioParam between contexts'}, + (task, should) => { + let g1; + let g2; + should( + () => {g1 = new GainNode(c1)}, 'Test 2: g1 = new GainNode(c1)') + .notThrow(); + should( + () => {g2 = new GainNode(c2)}, 'Test 2: g2 = new GainNode(c2)') + .notThrow(); + should(() => {g2.connect(g1.gain)}, 'Test 2: g2.connect(g1.gain)') + .throw(DOMException, 'InvalidAccessError'); + task.done(); + }); + + audit.define( + {label: 'Test 3', description: 'Disconnect nodes between contexts'}, + (task, should) => { + let g1; + let g2; + should( + () => {g1 = new GainNode(c1)}, 'Test 3: g1 = new GainNode(c1)') + .notThrow(); + should( + () => {g2 = new GainNode(c2)}, 'Test 3: g2 = new GainNode(c2)') + .notThrow(); + should(() => {g2.disconnect(g1)}, 'Test 3: g2.disconnect(g1)') + .throw(DOMException, 'InvalidAccessError'); + task.done(); + }); + + audit.define( + { + label: 'Test 4', + description: 'Disconnect AudioParam between contexts' + }, + (task, should) => { + let g1; + let g2; + should( + () => {g1 = new GainNode(c1)}, 'Test 4: g1 = new GainNode(c1)') + .notThrow(); + should( + () => {g2 = new GainNode(c2)}, 'Test 4: g2 = new GainNode(c2)') + .notThrow(); + should( + () => {g2.disconnect(g1.gain)}, 'Test 4: g2.connect(g1.gain)') + .throw(DOMException, 'InvalidAccessError'); + task.done(); + }); + + audit.run(); + </script> + </body> +</html> |