test_peerConnection_restartIceLocalRollback.html (2114B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="pc.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 createHTML({ 10 bug: "906986", 11 title: "Renegotiation: restart ice, local rollback" 12 }); 13 14 var test; 15 runNetworkTest(function (options) { 16 test = new PeerConnectionTest(options); 17 18 addRenegotiation(test.chain, 19 [ 20 // causes a full, normal ice restart 21 function PC_LOCAL_SET_OFFER_OPTION(test) { 22 test.setOfferOptions({ iceRestart: true }); 23 }, 24 // causes an ice restart and then rolls it back 25 // (does not result in sending an offer) 26 function PC_LOCAL_SETUP_ICE_HANDLER(test) { 27 test.pcLocal.setupIceCandidateHandler(test, () => {}); 28 }, 29 function PC_LOCAL_CREATE_AND_SET_OFFER(test) { 30 return test.createOffer(test.pcLocal).then(offer => { 31 return test.setLocalDescription(test.pcLocal, 32 offer, 33 HAVE_LOCAL_OFFER); 34 }); 35 }, 36 function PC_LOCAL_WAIT_FOR_GATHERING(test) { 37 return new Promise(r => { 38 test.pcLocal._pc.addEventListener("icegatheringstatechange", () => { 39 if (test.pcLocal._pc.iceGatheringState == "gathering") { 40 r(); 41 } 42 }); 43 }); 44 }, 45 function PC_LOCAL_ROLLBACK(test) { 46 return test.setLocalDescription(test.pcLocal, 47 { type: "rollback", sdp: ""}, 48 STABLE); 49 }, 50 // Rolling back should shut down gathering 51 function PC_LOCAL_WAIT_FOR_END_OF_TRICKLE(test) { 52 return test.pcLocal.endOfTrickleIce; 53 }, 54 ] 55 ); 56 57 // for now, only use one stream, because rollback doesn't seem to 58 // like multiple streams. See bug 1259465. 59 test.setMediaConstraints([{audio: true}], 60 [{audio: true}]); 61 return test.run(); 62 }); 63 64 </script> 65 </pre> 66 </body> 67 </html>