diff options
Diffstat (limited to 'testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html')
-rw-r--r-- | testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html b/testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html index 156a2e1f09..282c362a2d 100644 --- a/testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html +++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-GC.https.html @@ -85,6 +85,36 @@ promise_test(async t => { await onVideoChange(); assert_not_equals(color, getVideoSignal(destVideo)); }, "GC does not collect a peer connection pipe rendering to a video element"); + +promise_test(async t => { + const pc1 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc2.close()); + + const [track, stream] = await createTrackAndStreamWithCleanup(t, "video"); + pc1.addTrack(track, stream); + exchangeIceCandidates(pc1, pc2); + + const metadataToBeLoaded = []; + pc2.ontrack = (e) => { + const stream = e.streams[0]; + const v = document.createElement('video'); + v.autoplay = true; + v.srcObject = stream; + v.id = stream.id + metadataToBeLoaded.push(new Promise((resolve) => { + v.addEventListener('loadedmetadata', () => { + resolve(); + }); + })); + }; + await exchangeOfferAnswer(pc1, pc2); + + garbageCollect(); + + await Promise.all(metadataToBeLoaded); +}, "GC does not collect an HTMLMediaElement playing a video track"); </script> </body> </html> |