Backed out changeset a9fcd0e98cc3 (bug 1231981)

This commit is contained in:
Carsten "Tomcat" Book 2016-04-25 16:28:53 +02:00
Родитель a41ff18ffd
Коммит 94cebd7b33
8 изменённых файлов: 32 добавлений и 118 удалений

Просмотреть файл

@ -337,12 +337,9 @@ function run_test(is_initiator,timeout) {
function runTestWhenReady(testFunc) {
setupEnvironment();
return testConfigured.then(options => testFunc(options))
.catch(e => {
ok(false, 'Error executing test: ' + e +
.catch(e => ok(false, 'Error executing test: ' + e +
((typeof e.stack === 'string') ?
(' ' + e.stack.split('\n').join(' ... ')) : ''));
SimpleTest.finish();
});
(' ' + e.stack.split('\n').join(' ... ')) : '')));
}

Просмотреть файл

@ -64,13 +64,7 @@ function PeerConnectionTest(options) {
options.rtcpmux = "rtcpmux" in options ? options.rtcpmux : true;
options.opus = "opus" in options ? options.opus : true;
if (iceServersArray.length) {
options.config_remote = options.config_remote || {}
options.config_local = options.config_local || {}
options.config_remote.iceServers = iceServersArray;
options.config_local.iceServers = iceServersArray;
}
else if (typeof turnServers !== "undefined") {
if (typeof turnServers !== "undefined") {
if ((!options.turn_disabled_local) && (turnServers.local)) {
if (!options.hasOwnProperty("config_local")) {
options.config_local = {};
@ -1685,7 +1679,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} stats
* The stats to be verified for relayed vs. direct connection.
*/
checkStatsIceConnectionType : function(stats, expectedLocalCandidateType) {
checkStatsIceConnectionType : function(stats) {
let lId;
let rId;
for (let stat of stats.values()) {
@ -1704,25 +1698,21 @@ PeerConnectionWrapper.prototype = {
"failed to find candidatepair IDs or stats for local: "+ lId +" remote: "+ rId);
return;
}
info("checkStatsIceConnectionType verifying: local=" +
JSON.stringify(lCand) + " remote=" + JSON.stringify(rCand));
expectedLocalCandidateType = expectedLocalCandidateType || "host";
var candidateType = lCand.candidateType;
if ((lCand.mozLocalTransport === "tcp") && (candidateType === "relayed")) {
candidateType = "relayed-tcp";
if ((this.configuration) && (typeof this.configuration.iceServers !== 'undefined')) {
info("Ice Server configured");
// Note: the IP comparising is a workaround for bug 1097333
// And this will fail if a TURN server address is a DNS name!
var serverIp = this.configuration.iceServers[0].url.split(':')[1];
ok(lCand.candidateType == "relayed" || rCand.candidateType == "relayed" ||
lCand.ipAddress === serverIp || rCand.ipAddress === serverIp,
"One peer uses a relay");
} else {
info("P2P configured");
ok(lCand.candidateType != "relayed" && rCand.candidateType != "relayed",
"Pure peer to peer call without a relay");
}
if ((expectedLocalCandidateType === "serverreflexive") &&
(candidateType === "peerreflexive")) {
// Be forgiving of prflx when expecting srflx, since that can happen due
// to timing.
candidateType = "serverreflexive";
}
is(candidateType,
expectedLocalCandidateType,
"Local candidate type is what we expected for selected pair");
},
/**
@ -1855,59 +1845,10 @@ function createHTML(options) {
return scriptsReady.then(() => realCreateHTML(options));
}
var iceServerWebsocket;
var iceServersArray = [];
var setupIceServerConfig = useIceServer => {
// We disable ICE support for HTTP proxy when using a TURN server, because
// mochitest uses a fake HTTP proxy to serve content, which will eat our STUN
// packets for TURN TCP.
var enableHttpProxy = enable => new Promise(resolve => {
SpecialPowers.pushPrefEnv(
{'set': [['media.peerconnection.disable_http_proxy', !enable]]},
resolve);
});
var spawnIceServer = () => new Promise( (resolve, reject) => {
iceServerWebsocket = new WebSocket("ws://localhost:8191/");
iceServerWebsocket.onopen = (event) => {
info("websocket/process bridge open, starting ICE Server...");
iceServerWebsocket.send("iceserver");
}
iceServerWebsocket.onmessage = event => {
// The first message will contain the iceServers configuration, subsequent
// messages are just logging.
info("ICE Server: " + event.data);
resolve(event.data);
}
iceServerWebsocket.onerror = () => {
reject("ICE Server error: Is the ICE server websocket up?");
}
iceServerWebsocket.onclose = () => {
info("ICE Server websocket closed");
reject("ICE Server gone before getting configuration");
}
});
if (!useIceServer) {
info("Skipping ICE Server for this test");
return enableHttpProxy(true);
}
return enableHttpProxy(false)
.then(spawnIceServer)
.then(iceServersStr => { iceServersArray = JSON.parse(iceServersStr); });
};
function runNetworkTest(testFunction, fixtureOptions) {
fixtureOptions = fixtureOptions || {}
function runNetworkTest(testFunction) {
return scriptsReady.then(() =>
runTestWhenReady(options =>
startNetworkAndTest()
.then(() => setupIceServerConfig(fixtureOptions.useIceServer))
.then(() => testFunction(options))
)
);

Просмотреть файл

@ -441,15 +441,13 @@ var commandsPeerConnectionOfferAnswer = [
function PC_LOCAL_CHECK_ICE_CONNECTION_TYPE(test) {
return test.pcLocal.getStats().then(stats => {
test.pcLocal.checkStatsIceConnectionType(stats,
test.testOptions.expectedLocalCandidateType);
test.pcLocal.checkStatsIceConnectionType(stats);
});
},
function PC_REMOTE_CHECK_ICE_CONNECTION_TYPE(test) {
return test.pcRemote.getStats().then(stats => {
test.pcRemote.checkStatsIceConnectionType(stats,
test.testOptions.expectedRemoteCandidateType);
test.pcRemote.checkStatsIceConnectionType(stats);
});
},

Просмотреть файл

@ -215,8 +215,8 @@ int nr_ice_candidate_create(nr_ice_ctx *ctx,nr_ice_component *comp,nr_ice_socket
nr_ice_candidate_compute_codeword(cand);
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): created candidate %s with type %s",
ctx->label,cand->codeword,cand->label,nr_ctype_name(ctype));
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): created candidate %s with type %s",
ctx->label,cand->label,nr_ctype_name(ctype));
*candp=cand;

Просмотреть файл

@ -515,7 +515,6 @@ void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg)
ctx = cand->ctx;
ctx->uninitialized_candidates--;
r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): initialized, %d remaining",ctx->label,cand->codeword,ctx->uninitialized_candidates);
/* Avoid the need for yet another initialization function */
if (cand->state == NR_ICE_CAND_STATE_INITIALIZING && cand->type == HOST)

Просмотреть файл

@ -243,20 +243,10 @@ PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
mIceRestartState(ICE_RESTART_NONE) {
}
nsresult
PeerConnectionMedia::InitProxy()
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
const std::vector<NrIceTurnServer>& turn_servers,
NrIceCtx::Policy policy)
{
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Allow mochitests to disable this, since mochitest configures a fake proxy
// that serves up content.
bool disable = Preferences::GetBool("media.peerconnection.disable_http_proxy",
false);
if (disable) {
mProxyResolveCompleted = true;
return NS_OK;
}
#endif
nsresult rv;
nsCOMPtr<nsIProtocolProxyService> pps =
do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
@ -314,16 +304,6 @@ PeerConnectionMedia::InitProxy()
return NS_ERROR_FAILURE;
}
return NS_OK;
}
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
const std::vector<NrIceTurnServer>& turn_servers,
NrIceCtx::Policy policy)
{
nsresult rv = InitProxy();
NS_ENSURE_SUCCESS(rv, rv);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);
#else

Просмотреть файл

@ -484,7 +484,6 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
SignalEndOfLocalCandidates;
private:
nsresult InitProxy();
class ProtocolProxyQueryHandler : public nsIProtocolProxyCallback {
public:
explicit ProtocolProxyQueryHandler(PeerConnectionMedia *pcm) :

Просмотреть файл

@ -528,7 +528,7 @@ class MochitestBase(object):
self.update_mozinfo()
self.server = None
self.wsserver = None
self.websocketprocessbridge = None
self.websocketProcessBridge = None
self.sslTunnel = None
self._active_tests = None
self._locations = None
@ -814,11 +814,11 @@ class MochitestBase(object):
command = [sys.executable,
os.path.join("websocketprocessbridge",
"websocketprocessbridge.py")]
self.websocketprocessbridge = mozprocess.ProcessHandler(command,
self.websocketProcessBridge = mozprocess.ProcessHandler(command,
cwd=SCRIPT_DIR)
self.websocketprocessbridge.run()
self.websocketProcessBridge.run()
self.log.info("runtests.py | websocket/process bridge pid: %d"
% self.websocketprocessbridge.pid)
% self.websocketProcessBridge.pid)
# ensure the server is up, wait for at most ten seconds
for i in range(1,100):
@ -892,12 +892,12 @@ class MochitestBase(object):
except Exception:
self.log.critical('Exception stopping ssltunnel')
if self.websocketprocessbridge is not None:
if self.websocketProcessBridge is not None:
try:
self.log.info('Stopping websocket/process bridge')
self.websocketprocessbridge.kill()
self.log.info('Stopping websocketProcessBridge')
self.websocketProcessBridge.kill()
except Exception:
self.log.critical('Exception stopping websocket/process bridge')
self.log.critical('Exception stopping websocketProcessBridge')
def copyExtraFilesToProfile(self, options):
"Copy extra files or dirs specified on the command line to the testing profile."