Index: LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html |
diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html b/LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html |
index 076e0d3e553f4cacd149eb520ef97d93f59698a3..32327ec3a30daeb88c2e0c4e1cc75f892c8bae45 100644 |
--- a/LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html |
+++ b/LayoutTests/fast/mediastream/RTCPeerConnection-lifetime.html |
@@ -7,8 +7,6 @@ |
<script> |
description("Tests the RTCPeerConnection lifetime."); |
-// This test times out if the Peer connection object is garbage collected. |
- |
var dc = null; |
function dataChannelMessage(m) |
@@ -24,7 +22,7 @@ function dataChannelOpen() |
shouldNotThrow("dc.send('xyzzy');"); |
} |
-function createPeerConnection() |
+function createPeerConnectionAndDataChannel() |
{ |
// The Peer Connection object is leaked |
var pc = new webkitRTCPeerConnection({iceServers:[]}, null); |
@@ -32,8 +30,31 @@ function createPeerConnection() |
dc.onopen = dataChannelOpen; |
} |
-createPeerConnection(); |
-gc(); |
+var pcB = null; |
+var observationB = null; |
+ |
+// Test that the PeerConnection object is gc'd if close is called. |
+var pcA = new webkitRTCPeerConnection(null, null); |
+var observationA = internals.observeGC(pcA); |
+pcA.close(); |
+pcA = null; |
+asyncGC(function() { |
+ shouldBeTrue('observationA.wasCollected'); |
+ observationA = null; |
+ |
+ // Test that the PeerConnection object is not gc'd if close is not called. |
+ pcB = new webkitRTCPeerConnection(null, null); |
+ observationB = internals.observeGC(pcB); |
+ pcB = null; |
+ asyncGC(function() { |
+ shouldBeFalse('observationB.wasCollected'); |
+ observationB = null; |
+ |
+ // This test times out if the Peer connection object is garbage collected. |
+ createPeerConnectionAndDataChannel(); |
+ asyncGC(function() {}); |
keishi
2014/06/17 11:12:04
nit: if we aren't using the callback, asyncGC() an
haraken
2014/06/17 11:43:45
I think you can just remove this asyncGC().
Henrik Grunell
2014/06/17 12:12:21
Changed to gc(). I think the point is (this test w
|
+ }); |
+}); |
window.jsTestIsAsync = true; |
window.successfullyParsed = true; |
keishi
2014/06/17 11:12:04
nit: successfullyParsed is handled in js-test.js n
Henrik Grunell
2014/06/17 12:12:20
Done.
|