summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
blob: af55a0c003512f98dc96d11c07e8a5099ed1f5ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>RTCPeerConnection.prototype.iceConnectionState - disconnection</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
  'use strict';
  promise_test(async t => {
    const caller = new RTCPeerConnection();
    t.add_cleanup(() => caller.close());
    const callee = new RTCPeerConnection();
    t.add_cleanup(() => callee.close());

    const stream = await getNoiseStream({audio:true});
    t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
    const [track] = stream.getTracks();
    caller.addTrack(track, stream);
    exchangeIceCandidates(caller, callee);
    await exchangeOfferAnswer(caller, callee);

    await listenToIceConnected(caller);

    callee.close();
    await waitForIceStateChange(caller, ['disconnected', 'failed']);
    // TODO: this should eventually transition to failed but that takes
    // somewhat long (15-30s) so is not testable.
  }, 'ICE goes to disconnected if the other side goes away');
</script>