RTCPeerConnection-restartIce-onnegotiationneeded.https.html (1067B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title></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 "use strict"; 9 10 promise_test(async t => { 11 const pc1 = new RTCPeerConnection(); 12 const pc2 = new RTCPeerConnection(); 13 t.add_cleanup(() => pc1.close()); 14 t.add_cleanup(() => pc2.close()); 15 16 pc1.addTransceiver("audio"); 17 18 await pc1.setLocalDescription(await pc1.createOffer()); 19 pc1.restartIce(); 20 await pc2.setRemoteDescription(pc1.localDescription); 21 await pc2.setLocalDescription(await pc2.createAnswer()); 22 await pc1.setRemoteDescription(pc2.localDescription); 23 // When the setRemoteDescription() promise above is resolved a task should be 24 // queued to fire the onnegotiationneeded event. Because of this, we should 25 // have time to hook up the event listener *after* awaiting the SRD promise. 26 await new Promise(r => pc1.onnegotiationneeded = r); 27 }, "Negotiation needed when returning to stable does not fire too early"); 28 29 </script>