Bug 1193731: basic ICE gathering state verification in mochitests draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Sat, 19 Nov 2016 11:19:50 -0800
changeset 442135 be23c0898451a61820de628e592ecc620e1cf9a3
parent 442134 fd7f5b29e90a94e39889147b06343c1c4300c64b
child 442136 5222c5a16281615e6604f3a2bd5e0a40b5361d85
push id36594
push userdrno@ohlmeier.org
push dateMon, 21 Nov 2016 20:11:22 +0000
bugs1193731
milestone53.0a1
Bug 1193731: basic ICE gathering state verification in mochitests MozReview-Commit-ID: Hmo64pFMOP7
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -786,16 +786,23 @@ function PeerConnectionWrapper(label, co
     });
     if (iceState === "connected") {
       this.iceConnectedResolve();
     } else if (iceState === "failed") {
       this.iceConnectedReject();
     }
   };
 
+  this._pc.onicegatheringstatechange = e => {
+    isnot(typeof this._pc.iceGatheringState, "undefined",
+          "iceGetheringState should not be undefined");
+    var gatheringState = this._pc.iceGatheringState;
+    info(this + ": onicegatheringstatechange fired, new state is: " + gatheringState);
+  };
+
   createOneShotEventWrapper(this, this._pc, 'datachannel');
   this._pc.addEventListener('datachannel', e => {
     var wrapper = new DataChannelWrapper(e.channel, this);
     this.dataChannels.push(wrapper);
   });
 
   createOneShotEventWrapper(this, this._pc, 'signalingstatechange');
   createOneShotEventWrapper(this, this._pc, 'negotiationneeded');
@@ -1279,21 +1286,18 @@ PeerConnectionWrapper.prototype = {
     this.endOfTrickleIce = new Promise(r => resolveEndOfTrickle = r);
     this.holdIceCandidates = new Promise(r => this.releaseIceCandidates = r);
 
     this._pc.onicecandidate = anEvent => {
       if (!anEvent.candidate) {
         this._pc.onicecandidate = () =>
           ok(false, this.label + " received ICE candidate after end of trickle");
         info(this.label + ": received end of trickle ICE event");
-        /* Bug 1193731. Accroding to WebRTC spec 4.3.1 the ICE Agent first sets
-         * the gathering state to completed (step 3.) before sending out the
-         * null newCandidate in step 4. */
-        todo(this._pc.iceGatheringState === 'completed',
-           "ICE gathering state has reached completed");
+        ok(this._pc.iceGatheringState === 'complete',
+           "ICE gathering state has reached complete");
         resolveEndOfTrickle(this.label);
         return;
       }
 
       info(this.label + ": iceCandidate = " + JSON.stringify(anEvent.candidate));
       ok(anEvent.candidate.candidate.length > 0, "ICE candidate contains candidate");
       ok(anEvent.candidate.sdpMid.length > 0, "SDP mid not empty");