destination.html (1605B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> 5 AudioDestinationNode 6 </title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 </head> 10 <body> 11 <script> 12 function assert_doesnt_throw(f, desc) { 13 try { 14 f(); 15 } catch (e) { 16 assert_true(false, desc); 17 return; 18 } 19 assert_true(true, desc); 20 } 21 22 test(function() { 23 var ac = new AudioContext(); 24 25 assert_equals(ac.destination.channelCount, 2, 26 "A DestinationNode should have two channels by default"); 27 28 assert_greater_than_equal(ac.destination.maxChannelCount, 2, 29 "maxChannelCount should be >= 2"); 30 31 assert_throws_dom("IndexSizeError", function() { 32 ac.destination.channelCount = ac.destination.maxChannelCount + 1 33 }, `Setting the channelCount to something greater than 34 the maxChannelCount should throw IndexSizeError`); 35 36 assert_throws_dom("NotSupportedError", function() { 37 ac.destination.channelCount = 0; 38 }, "Setting the channelCount to 0 should throw NotSupportedError"); 39 40 assert_doesnt_throw(function() { 41 ac.destination.channelCount = ac.destination.maxChannelCount; 42 }, "Setting the channelCount to maxChannelCount should not throw"); 43 44 assert_doesnt_throw(function() { 45 ac.destination.channelCount = 1; 46 }, "Setting the channelCount to 1 should not throw"); 47 }); 48 49 </script> 50 </body> 51 </html>