Bug 1010641 - Record the ICE connection state transitions. r=bwc

This commit is contained in:
Nils Ohlmeier [:drno] 2014-06-12 11:48:00 -04:00
parent 12fa73157c
commit 9200bce6f7
2 changed files with 58 additions and 0 deletions

View File

@ -1708,6 +1708,21 @@ PeerConnectionWrapper.prototype = {
return (this.isIceChecking() || this.isIceNew());
},
/**
* Registers a callback for the ICE connection state change and
* appends the new state to an array for logging it later.
*/
logIceConnectionState: function PCW_logIceConnectionState() {
var self = this;
function logIceConState () {
self.iceConnectionLog.push(self._pc.iceConnectionState);
}
self.iceConnectionLog = [self._pc.iceConnectionState];
self.ice_connection_callbacks.logIceStatus = logIceConState;
},
/**
* Registers a callback for the ICE connection state change and
* reports success (=connected) or failure via the callbacks.

View File

@ -19,6 +19,13 @@ function dumpSdp(test) {
dump("ERROR: SDP answer: " + test._remote_answer.sdp.replace(/[\r]/g, ''));
}
if (typeof test.pcLocal.iceConnectionLog !== 'undefined') {
dump("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog + "\n");
}
if (typeof test.pcRemote.iceConnectionLog !== 'undefined') {
dump("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog + "\n");
}
if ((typeof test.pcLocal.setRemoteDescDate !== 'undefined') &&
(typeof test.pcRemote.setLocalDescDate !== 'undefined')) {
var delta = deltaSeconds(test.pcLocal.setRemoteDescDate, test.pcRemote.setLocalDescDate);
@ -69,6 +76,20 @@ var commandsPeerConnection = [
test.next();
}
],
[
'PC_LOCAL_SETUP_ICE_LOGGER',
function (test) {
test.pcLocal.logIceConnectionState();
test.next();
}
],
[
'PC_REMOTE_SETUP_ICE_LOGGER',
function (test) {
test.pcRemote.logIceConnectionState();
test.next();
}
],
[
'PC_LOCAL_CREATE_OFFER',
function (test) {
@ -178,6 +199,7 @@ var commandsPeerConnection = [
var myPc = myTest.pcLocal;
function onIceConnectedSuccess () {
info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog);
ok(true, "pc_local: ICE switched to 'connected' state");
myTest.next();
};
@ -188,6 +210,7 @@ var commandsPeerConnection = [
};
if (myPc.isIceConnected()) {
info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog);
ok(true, "pc_local: ICE is in connected state");
myTest.next();
} else if (myPc.isIceConnectionPending()) {
@ -206,6 +229,7 @@ var commandsPeerConnection = [
var myPc = myTest.pcRemote;
function onIceConnectedSuccess () {
info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog);
ok(true, "pc_remote: ICE switched to 'connected' state");
myTest.next();
};
@ -216,6 +240,7 @@ var commandsPeerConnection = [
};
if (myPc.isIceConnected()) {
info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog);
ok(true, "pc_remote: ICE is in connected state");
myTest.next();
} else if (myPc.isIceConnectionPending()) {
@ -300,6 +325,13 @@ var commandsDataChannel = [
test.next();
}
],
[
'PC_LOCAL_SETUP_ICE_LOGGER',
function (test) {
test.pcLocal.logIceConnectionState();
test.next();
}
],
[
'PC_REMOTE_GUM',
function (test) {
@ -316,6 +348,13 @@ var commandsDataChannel = [
test.next();
}
],
[
'PC_REMOTE_SETUP_ICE_LOGGER',
function (test) {
test.pcRemote.logIceConnectionState();
test.next();
}
],
[
'PC_LOCAL_CREATE_DATA_CHANNEL',
function (test) {
@ -428,6 +467,7 @@ var commandsDataChannel = [
var myPc = myTest.pcLocal;
function onIceConnectedSuccess () {
info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog);
ok(true, "pc_local: ICE switched to 'connected' state");
myTest.next();
};
@ -438,6 +478,7 @@ var commandsDataChannel = [
};
if (myPc.isIceConnected()) {
info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog);
ok(true, "pc_local: ICE is in connected state");
myTest.next();
} else if (myPc.isIceConnectionPending()) {
@ -456,6 +497,7 @@ var commandsDataChannel = [
var myPc = myTest.pcRemote;
function onIceConnectedSuccess () {
info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog);
ok(true, "pc_remote: ICE switched to 'connected' state");
myTest.next();
};
@ -466,6 +508,7 @@ var commandsDataChannel = [
};
if (myPc.isIceConnected()) {
info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog);
ok(true, "pc_remote: ICE is in connected state");
myTest.next();
} else if (myPc.isIceConnectionPending()) {