bug 943898: Add ice state checking to webrtc mochitest framework r=ekr,jsmith

This commit is contained in:
Randell Jesup 2013-12-05 18:10:21 -05:00
parent 90180a2448
commit 6443657acb

View File

@ -968,11 +968,22 @@ function PeerConnectionWrapper(label, configuration) {
info("Creating " + this);
this._pc = new mozRTCPeerConnection(this.configuration);
is(this._pc.iceConnectionState, "new", "iceConnectionState starts at 'new'");
/**
* Setup callback handlers
*/
var self = this;
// This enables tests to validate that the next ice state is the one they expect to happen
this.next_ice_state = ""; // in most cases, the next state will be "checking", but in some tests "closed"
this._pc.oniceconnectionstatechange = function() {
ok(self._pc.iceConnectionState != undefined, "iceConnectionState should not be undefined");
if (self.next_ice_state != "") {
is(self._pc.iceConnectionState, self.next_ice_state, "iceConnectionState changed to '" +
self.next_ice_state + "'");
self.next_ice_state = "";
}
};
this.ondatachannel = unexpectedEventAndFinish(this, 'ondatachannel');
this.onsignalingstatechange = unexpectedEventAndFinish(this, 'onsignalingstatechange');
@ -982,7 +993,6 @@ function PeerConnectionWrapper(label, configuration) {
* @param {Object} event
* Event data which includes the stream to be added
*/
var self = this;
this._pc.onaddstream = function (event) {
info(self + ": 'onaddstream' event fired for " + event.stream);