Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / RTCPeerConnection-lifetime.html
blob8ca415eb4af0955a8ec72206dbdaeef84b8889f2
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Tests the RTCPeerConnection lifetime.");
10 var dc = null;
12 function dataChannelMessage(m)
14 testPassed("dataChannelMessage");
15 finishJSTest();
18 function dataChannelOpen()
20 testPassed("dataChannelOpen");
21 dc.onmessage = dataChannelMessage;
22 shouldNotThrow("dc.send('xyzzy');");
25 function createPeerConnectionAndDataChannel()
27 // The Peer Connection object is leaked
28 var pc = new webkitRTCPeerConnection({iceServers:[]}, null);
29 dc = pc.createDataChannel("label");
30 dc.onopen = dataChannelOpen;
33 var pcB = null;
34 var observationB = null;
36 // Test that the PeerConnection object is gc'd if close is called.
37 var pcA = new webkitRTCPeerConnection(null, null);
38 var observationA = internals.observeGC(pcA);
39 pcA.close();
40 pcA = null;
41 asyncGC(function() {
42 shouldBeTrue('observationA.wasCollected');
43 observationA = null;
45 // Test that the PeerConnection object is not gc'd if close is not called.
46 pcB = new webkitRTCPeerConnection(null, null);
47 observationB = internals.observeGC(pcB);
48 pcB = null;
49 asyncGC(function() {
50 shouldBeFalse('observationB.wasCollected');
51 observationB = null;
53 // This test times out if the Peer connection object is garbage collected.
54 createPeerConnectionAndDataChannel();
55 gc();
56 });
57 });
59 window.jsTestIsAsync = true;
60 </script>
61 </body>
62 </html>