content/media/webaudio/test/test_badConnect.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webaudio/test/test_badConnect.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test whether we can create an AudioContext interface</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +</head>
    1.11 +<body>
    1.12 +<pre id="test">
    1.13 +<script src="webaudio.js" type="text/javascript"></script>
    1.14 +<script class="testbody" type="text/javascript">
    1.15 +
    1.16 +SimpleTest.waitForExplicitFinish();
    1.17 +addLoadEvent(function() {
    1.18 +  var context1 = new AudioContext();
    1.19 +  var context2 = new AudioContext();
    1.20 +
    1.21 +  var destination1 = context1.destination;
    1.22 +  var destination2 = context2.destination;
    1.23 +
    1.24 +  isnot(destination1, destination2, "Destination nodes should not be the same");
    1.25 +  isnot(destination1.context, destination2.context, "Destination nodes should not have the same context");
    1.26 +
    1.27 +  var source1 = context1.createBufferSource();
    1.28 +
    1.29 +  expectException(function() {
    1.30 +    source1.connect(destination1, 1);
    1.31 +  }, DOMException.INDEX_SIZE_ERR);
    1.32 +  expectException(function() {
    1.33 +    source1.connect(destination1, 0, 1);
    1.34 +  }, DOMException.INDEX_SIZE_ERR);
    1.35 +  expectException(function() {
    1.36 +    source1.connect(destination2);
    1.37 +  }, DOMException.SYNTAX_ERR);
    1.38 +
    1.39 +  source1.connect(destination1);
    1.40 +
    1.41 +  expectException(function() {
    1.42 +    source1.disconnect(1);
    1.43 +  }, DOMException.INDEX_SIZE_ERR);
    1.44 +
    1.45 +  SimpleTest.finish();
    1.46 +});
    1.47 +
    1.48 +</script>
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial