tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RTCPeerConnection-onicecandidateerror.https.html (1548B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerConnection.prototype.onicecandidateerror</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="RTCPeerConnection-helper.js"></script>
      7 <script>
      8 
      9 promise_test(async t => {
     10  const config = {
     11    iceServers: [{urls: "turn:123", username: "123", credential: "123"}]
     12  };
     13  const pc = new RTCPeerConnection(config);
     14  t.add_cleanup(() => pc.close());
     15  const onErrorPromise = addEventListenerPromise(t, pc, 'icecandidateerror', event => {
     16     assert_true(event instanceof RTCPeerConnectionIceErrorEvent,
     17      'Expect event to be instance of RTCPeerConnectionIceErrorEvent');
     18    // Do not hardcode any specific errors here. Instead only verify
     19    // that all the fields contain something expected.
     20    // Testing of event.errorText can be added later once it's content is
     21    // specified in spec with more detail.
     22    assert_true(event.errorCode >= 300 && event.errorCode <= 799, "errorCode");
     23    if (event.port == 0) {
     24      assert_equals(event.address, null);
     25    } else {
     26      assert_true(event.address.includes(".") || event.address.includes(":"));
     27    }
     28    assert_true(event.url.includes("123"), "url");
     29  });
     30  const stream = await getNoiseStream({audio:true});
     31  t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
     32  pc.addTrack(stream.getAudioTracks()[0], stream);
     33 
     34  await pc.setLocalDescription(await pc.createOffer());
     35  await onErrorPromise;
     36 }, 'Surfacing onicecandidateerror');
     37 
     38 </script>