testing/web-platform/tests/webrtc/RTCPeerConnection-onsignalingstatechanged.https.html
author Guido Urdaneta <guidou@chromium.org>
Wed, 06 Mar 2019 12:35:06 +0000
changeset 522276 fff147f5ba18269e1d3d1dc1861718f42c4aefe0
permissions -rw-r--r--
Bug 1526801 [wpt PR 15292] - [PeerConnection] Fire signalingstatechange event at the right time, a=testonly Automatic update from web-platform-tests [PeerConnection] Fire signalingstatechange event at the right time Prior to this CL, the event was fired before the transceiver state was updated, in contradiction with the spec, which says it should be fired after the transceiver state is updated. Bug: 920200 Change-Id: I757cc0161a5da4888cd628619180e24a54dc732b Reviewed-on: https://chromium-review.googlesource.com/c/1458203 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#634609} -- wpt-commits: 0f4203743c56377734f9682abb015d56d6a1a71e wpt-pr: 15292

<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection onsignalingstatechanged</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>

promise_test(async t => {
  const [track] = (await navigator.mediaDevices.getUserMedia({video: true})).getTracks();
  t.add_cleanup(() => track.stop());
  const pc1 = new RTCPeerConnection();
  t.add_cleanup(() => pc1.close());
  const pc2 = new RTCPeerConnection();
  t.add_cleanup(() => pc2.close());
  pc1.addTrack(track, new MediaStream());
  await pc1.setLocalDescription(await pc1.createOffer());
  await pc2.setRemoteDescription(pc1.localDescription);
  const signalingStateChangeResolver = new Resolver();
  pc2.onsignalingstatechange = t.step_func(e => {
    const transceiver = pc2.getTransceivers()[0];
    assert_equals(pc2.signalingState, "stable");
    assert_equals(transceiver.currentDirection, "recvonly");
    signalingStateChangeResolver.resolve();
  });
  await pc2.setLocalDescription(await pc2.createAnswer());
  await signalingStateChangeResolver;
});

</script>