summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html')
-rw-r--r--testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html b/testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html
new file mode 100644
index 0000000000..1af0e0f010
--- /dev/null
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-destinationnode-interface/destination.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>
+ AudioDestinationNode
+ </title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ function assert_doesnt_throw(f, desc) {
+ try {
+ f();
+ } catch (e) {
+ assert_true(false, desc);
+ return;
+ }
+ assert_true(true, desc);
+ }
+
+ test(function() {
+ var ac = new AudioContext();
+
+ assert_equals(ac.destination.channelCount, 2,
+ "A DestinationNode should have two channels by default");
+
+ assert_greater_than_equal(ac.destination.maxChannelCount, 2,
+ "maxChannelCount should be >= 2");
+
+ assert_throws_dom("IndexSizeError", function() {
+ ac.destination.channelCount = ac.destination.maxChannelCount + 1
+ }, `Setting the channelCount to something greater than
+ the maxChannelCount should throw IndexSizeError`);
+
+ assert_throws_dom("NotSupportedError", function() {
+ ac.destination.channelCount = 0;
+ }, "Setting the channelCount to 0 should throw NotSupportedError");
+
+ assert_doesnt_throw(function() {
+ ac.destination.channelCount = ac.destination.maxChannelCount;
+ }, "Setting the channelCount to maxChannelCount should not throw");
+
+ assert_doesnt_throw(function() {
+ ac.destination.channelCount = 1;
+ }, "Setting the channelCount to 1 should not throw");
+ });
+
+ </script>
+ </body>
+</html>