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 (b5c5ba07d3db)

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
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="nonTrickleIce.js"></script>
  <script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
  bug: "1435789",
  title: "WebRTC local-candidate relayProtocol stats attribute"
});

// This test uses the NAT simulator in order to get srflx candidates.
// It doesn't work in https, so we turn on getUserMedia in http, which requires
// a reload.
if (!("mediaDevices" in navigator)) {
  SpecialPowers.pushPrefEnv({set: [['media.devices.insecure.enabled', true]]},
                            () => location.reload());
} else {
  runNetworkTest(async (options = {}) => {
    await pushPrefs(
        ['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'],
        ['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'],
        ['media.getusermedia.insecure.enabled', true]);
    const test = new PeerConnectionTest(options);
    makeOffererNonTrickle(test.chain);
    makeAnswererNonTrickle(test.chain);

    test.chain.removeAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW");
    test.chain.append([PC_LOCAL_TEST_LOCAL_STATS_RELAYCANDIDATE]);

    test.setMediaConstraints([{ audio: true }], [{ audio: true }]);
    test.run();
  }, { useIceServer: true });
}

var PC_LOCAL_TEST_LOCAL_STATS_RELAYCANDIDATE = test => {
  return test.pcLocal.getStats().then(stats => {
    let haveRelayProtocol = {};
    for (let [k, v] of stats) {
      if (v.type == "local-candidate") {
        haveRelayProtocol[v.candidateType + "-" + v.relayProtocol] = v.relayProtocol;
      }
    }
    is(haveRelayProtocol["host-undefined"], undefined, "relayProtocol not set for host candidates");
    is(haveRelayProtocol["srvflx-undefined"], undefined, "relayProtocol not set for server reflexive candidates");
    ok(haveRelayProtocol["relay-udp"], "Has UDP relay candidate");
    ok(haveRelayProtocol["relay-tcp"], "Has TCP relay candidate");
    // TURN/TLS does not work, see https://bugzilla.mozilla.org/show_bug.cgi?id=1323439
    // With TURN/TLS working, we should have exactly five entries in haveRelayProtocol.
    todo(haveRelayProtocol["relay-tls"], "Has TLS relay candidate. See https://bugzilla.mozilla.org/show_bug.cgi?id=1323439");
    is(Object.keys(haveRelayProtocol).length, 4, "All candidate types are accounted for");
  });
}
</script>
</pre>
</body>
</html>