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

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

Issue 650063002: Move MediaStream and MediaStreamTrack implementation from modules/mediastream to core/mediastream. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 6 years, 2 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
OLDNEW
(Empty)
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.");
9
10 var dc = null;
11
12 function dataChannelMessage(m)
13 {
14 testPassed("dataChannelMessage");
15 finishJSTest();
16 }
17
18 function dataChannelOpen()
19 {
20 testPassed("dataChannelOpen");
21 dc.onmessage = dataChannelMessage;
22 shouldNotThrow("dc.send('xyzzy');");
23 }
24
25 function createPeerConnectionAndDataChannel()
26 {
27 // The Peer Connection object is leaked
28 var pc = new webkitRTCPeerConnection({iceServers:[]}, null);
29 dc = pc.createDataChannel("label");
30 dc.onopen = dataChannelOpen;
31 }
32
33 var pcB = null;
34 var observationB = null;
35
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;
44
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;
52
53 // This test times out if the Peer connection object is garbage collecte d.
54 createPeerConnectionAndDataChannel();
55 gc();
56 });
57 });
58
59 window.jsTestIsAsync = true;
60 </script>
61 </body>
62 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698