summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-audionode-interface/different-contexts.html
diff options
context:
space:
mode:
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.html101
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>