content/media/webaudio/test/test_badConnect.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test whether we can create an AudioContext interface</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 </head>
michael@0 8 <body>
michael@0 9 <pre id="test">
michael@0 10 <script src="webaudio.js" type="text/javascript"></script>
michael@0 11 <script class="testbody" type="text/javascript">
michael@0 12
michael@0 13 SimpleTest.waitForExplicitFinish();
michael@0 14 addLoadEvent(function() {
michael@0 15 var context1 = new AudioContext();
michael@0 16 var context2 = new AudioContext();
michael@0 17
michael@0 18 var destination1 = context1.destination;
michael@0 19 var destination2 = context2.destination;
michael@0 20
michael@0 21 isnot(destination1, destination2, "Destination nodes should not be the same");
michael@0 22 isnot(destination1.context, destination2.context, "Destination nodes should not have the same context");
michael@0 23
michael@0 24 var source1 = context1.createBufferSource();
michael@0 25
michael@0 26 expectException(function() {
michael@0 27 source1.connect(destination1, 1);
michael@0 28 }, DOMException.INDEX_SIZE_ERR);
michael@0 29 expectException(function() {
michael@0 30 source1.connect(destination1, 0, 1);
michael@0 31 }, DOMException.INDEX_SIZE_ERR);
michael@0 32 expectException(function() {
michael@0 33 source1.connect(destination2);
michael@0 34 }, DOMException.SYNTAX_ERR);
michael@0 35
michael@0 36 source1.connect(destination1);
michael@0 37
michael@0 38 expectException(function() {
michael@0 39 source1.disconnect(1);
michael@0 40 }, DOMException.INDEX_SIZE_ERR);
michael@0 41
michael@0 42 SimpleTest.finish();
michael@0 43 });
michael@0 44
michael@0 45 </script>
michael@0 46 </pre>
michael@0 47 </body>
michael@0 48 </html>

mercurial