DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b6d82b1a6b02)

VCS Links

Line Code
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    bug: "1264479",
    title: "PeerConnection verify current and pending descriptions"
  });

  var pc1 = new RTCPeerConnection();
  var pc2 = new RTCPeerConnection();

  var add = (pc, can, failed) => can && pc.addIceCandidate(can).catch(failed);
  pc1.onicecandidate = e => add(pc2, e.candidate, generateErrorCallback());
  pc2.onicecandidate = e => add(pc1, e.candidate, generateErrorCallback());

  var v1, v2;

  runNetworkTest(function() {
    v1 = createMediaElement('video', 'v1');
    v2 = createMediaElement('video', 'v2');

    navigator.mediaDevices.getUserMedia({ video: true, audio: true })
    .then(stream => (v1.srcObject = stream).getTracks().forEach(t => pc1.addTrack(t, stream)))
    .then(() => pc1.createOffer({})) // check that createOffer accepts arg.
    .then(offer => pc1.setLocalDescription(offer))
    .then(() => {
      ok(!pc1.currentLocalDescription, "pc1 currentLocalDescription is empty");
      ok(pc1.pendingLocalDescription, "pc1 pendingLocalDescription is set");
      ok(pc1.localDescription, "pc1 localDescription is set");
    })
    .then(() => pc2.setRemoteDescription(pc1.localDescription))
    .then(() => {
      ok(!pc2.currentRemoteDescription, "pc2 currentRemoteDescription is empty");
      ok(pc2.pendingRemoteDescription, "pc2 pendingRemoteDescription is set");
      ok(pc2.remoteDescription, "pc2 remoteDescription is set");
    })
    .then(() => pc2.createAnswer({}))  // check that createAnswer accepts arg.
    .then(answer => pc2.setLocalDescription(answer))
    .then(() => {
      ok(pc2.currentLocalDescription, "pc2 currentLocalDescription is set");
      ok(!pc2.pendingLocalDescription, "pc2 pendingLocalDescription is empty");
      ok(pc2.localDescription, "pc2 localDescription is set");
    })
    .then(() => pc1.setRemoteDescription(pc2.localDescription))
    .then(() => {
      ok(pc1.currentRemoteDescription, "pc1 currentRemoteDescription is set");
      ok(!pc1.pendingRemoteDescription, "pc1 pendingRemoteDescription is empty");
      ok(pc1.remoteDescription, "pc1 remoteDescription is set");
    })
    .catch(reason => ok(false, "unexpected failure: " + reason))
    .then(networkTestFinished);
  });
</script>
</pre>
</body>
</html>