Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html

Issue 329093002: Allow PeerConnection to be garbage collected after close(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("Tests the RTCPeerConnection lifetime."); 8 description("Tests the RTCPeerConnection lifetime.");
9 9
10 // This test times out if the Peer connection object is garbage collected. 10 // This test times out if the Peer connection object is garbage collected.
11 11
12 var dc = null; 12 var dc = null;
13 13
14 function dataChannelMessage(m) 14 function dataChannelMessage(m)
15 { 15 {
16 testPassed("dataChannelMessage"); 16 testPassed("dataChannelMessage");
17 finishJSTest(); 17 finishJSTest();
18 } 18 }
19 19
20 function dataChannelOpen() 20 function dataChannelOpen()
21 { 21 {
22 testPassed("dataChannelOpen"); 22 testPassed("dataChannelOpen");
23 dc.onmessage = dataChannelMessage; 23 dc.onmessage = dataChannelMessage;
24 shouldNotThrow("dc.send('xyzzy');"); 24 shouldNotThrow("dc.send('xyzzy');");
25 } 25 }
26 26
27 function createPeerConnection() 27 function createPeerConnectionAndDataChannel()
28 { 28 {
29 // The Peer Connection object is leaked 29 // The Peer Connection object is leaked
30 var pc = new webkitRTCPeerConnection({iceServers:[]}, null); 30 var pc = new webkitRTCPeerConnection({iceServers:[]}, null);
31 dc = pc.createDataChannel("label"); 31 dc = pc.createDataChannel("label");
32 dc.onopen = dataChannelOpen; 32 dc.onopen = dataChannelOpen;
33 } 33 }
34 34
35 createPeerConnection(); 35 // Test that the PeerConnection object is gc'd if close is called.
36 var pcA = new webkitRTCPeerConnection(null, null);
37 observationA = internals.observeGC(pcA);
38 pcA.close();
39 pcA = null;
40 gc();
41 shouldBeTrue('observationA.wasCollected');
42 observationA = null;
43
44 // Test that the PeerConnection object is not gc'd if close is not called.
haraken 2014/06/15 13:43:57 I'm fine with this behavior, but I'm a bit concern
Henrik Grunell 2014/06/16 07:48:59 Agree. The proposed spec change only says that it
45 var pcB = new webkitRTCPeerConnection(null, null);
46 observationB = internals.observeGC(pcB);
47 pcB = null;
48 gc();
49 shouldBeFalse('observationB.wasCollected');
50 observationB = null;
51
52 createPeerConnectionAndDataChannel();
36 gc(); 53 gc();
37 54
38 window.jsTestIsAsync = true; 55 window.jsTestIsAsync = true;
39 window.successfullyParsed = true; 56 window.successfullyParsed = true;
40 </script> 57 </script>
41 </body> 58 </body>
42 </html> 59 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698