dom/media/tests/mochitest/test_peerConnection_bug827843.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     5   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="application/javascript" src="head.js"></script>
     7   <script type="application/javascript" src="pc.js"></script>
     8   <script type="application/javascript" src="templates.js"></script>
     9 </head>
    10 <body>
    11 <pre id="test">
    12 <script type="application/javascript">
    13   createHTML({
    14     bug: "827843",
    15     title: "Ensure that localDescription and remoteDescription are null after close"
    16   });
    18   var steps = [
    19     [
    20       "CHECK_FOR_SANE_SDP",
    21       function (test) {
    22         // TODO: We might want to move those checks into the default chain
    23         ok(test.pcLocal.localDescription,
    24            "test.pcLocal.localDescription is not null");
    25         is(test.pcLocal.localDescription.type, "offer",
    26            "test.pcLocal.localDescription type is offer");
    27         ok(test.pcLocal.localDescription.sdp.length > 10,
    28            "test.pcLocal.localDescription body length is plausible");
    30         ok(test.pcLocal.remoteDescription,
    31            "test.pcLocal.remoteDescription is not null");
    32         is(test.pcLocal.remoteDescription.type, "answer",
    33             "test.pcLocal.remoteDescription type is answer");
    34         ok(test.pcLocal.remoteDescription.sdp.length > 10,
    35            "test.pcLocal.remoteDescription body length is plausible");
    37         ok(test.pcRemote.localDescription,
    38            "test.pcRemote.localDescription is not null");
    39         is(test.pcRemote.localDescription.type, "answer",
    40            "test.pcRemote.localDescription type is answer");
    41         ok(test.pcRemote.localDescription.sdp.length > 10,
    42            "test.pcRemote.localDescription body length is plausible");
    44         ok(test.pcRemote.remoteDescription,
    45            "test.pcRemote.remoteDescription is not null");
    46         is(test.pcRemote.remoteDescription.type, "offer",
    47            "test.pcRemote.remoteDescription type is offer");
    48         ok(test.pcRemote.remoteDescription.sdp.length > 10,
    49            "test.pcRemote.remoteDescription body length is plausible");
    51         test.next();
    52       }
    53     ], [
    54       "CHECK_SDP_ON_CLOSED_PC",
    55       function (test) {
    56         var description;
    57         var exception = null;
    59         // handle the event which the close() triggers
    60         test.pcLocal.onsignalingstatechange = function (state) {
    61           is(state, "closed", "Received expected onsignalingstatechange event 'closed'");
    62         }
    64         test.pcLocal.close();
    66         try { description = test.pcLocal.localDescription; } catch (e) { exception = e; }
    67         ok(exception, "Attempt to access localDescription of pcLocal after close throws exception");
    68         exception = null;
    70         try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; }
    71         ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception");
    72         exception = null;
    74         // handle the event which the close() triggers
    75         test.pcRemote.onsignalingstatechange = function (state) {
    76           is(state, "closed", "Received expected onsignalingstatechange event 'closed'");
    77         }
    79         test.pcRemote.close();
    81         try  { description = test.pcRemote.localDescription; } catch (e) { exception = e; }
    82         ok(exception, "Attempt to access localDescription of pcRemote after close throws exception");
    83         exception = null;
    85         try  { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; }
    86         ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception");
    88         test.next();
    89       }
    90     ]
    91   ];
    93   var test;
    94   runTest(function () {
    95     test = new PeerConnectionTest();
    96     test.setMediaConstraints([{audio: true}], [{audio: true}]);
    97     test.chain.append(steps);
    98     test.run();
    99   });
   100 </script>
   101 </pre>
   102 </body>
   103 </html>

mercurial