OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>RTCDataChannel Content Browser Test</title> | 2 <title>RTCDataChannel Content Browser Test</title> |
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 // Tests that an RTCDataChannel with event handlers is not garbage-collected | 6 // Tests that an RTCDataChannel with event handlers is not garbage-collected |
7 // prematurely. | 7 // prematurely. |
8 function testDataChannelGC() { | 8 function testDataChannelGC() { |
9 var pc1 = new webkitRTCPeerConnection(null); | 9 var pc1 = new RTCPeerConnection(); |
10 var pc2 = new webkitRTCPeerConnection(null); | 10 var pc2 = new RTCPeerConnection(); |
11 | 11 |
12 var iceCandidateHandler = function(rpc) { | 12 var iceCandidateHandler = function(rpc) { |
13 return function(e) { | 13 return function(e) { |
14 if (e.candidate) { | 14 if (e.candidate) { |
15 rpc.addIceCandidate(e.candidate); | 15 rpc.addIceCandidate(e.candidate); |
16 } | 16 } |
17 } | 17 } |
18 }; | 18 }; |
19 | 19 |
20 pc1.addEventListener("icecandidate", iceCandidateHandler(pc2)); | 20 pc1.addEventListener("icecandidate", iceCandidateHandler(pc2)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 pc2.setRemoteDescription(sdp1, function() { | 56 pc2.setRemoteDescription(sdp1, function() { |
57 console.log("creating answer"); | 57 console.log("creating answer"); |
58 pc2.createAnswer(function(sdp2) { | 58 pc2.createAnswer(function(sdp2) { |
59 pc1.setRemoteDescription(sdp2); | 59 pc1.setRemoteDescription(sdp2); |
60 pc2.setLocalDescription(sdp2); | 60 pc2.setLocalDescription(sdp2); |
61 }, error => failTest(error.toString())); | 61 }, error => failTest(error.toString())); |
62 }, error => failTest(error.toString())); | 62 }, error => failTest(error.toString())); |
63 }, error => failTest(error.toString())); | 63 }, error => failTest(error.toString())); |
64 } | 64 } |
65 </script> | 65 </script> |
OLD | NEW |