Backed out changeset 899c470e0275 (bug 1087551) for build bustage. r=bustage fix for CLOSED TREE

This commit is contained in:
Sebastian Hengst 2015-05-09 10:34:24 +02:00
parent 738d1fc4f5
commit bed2514c45
5 changed files with 37 additions and 67 deletions

View File

@ -67,7 +67,7 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' || toolkit == 'android' # Bug
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || toolkit == 'android' # Bug 1063290, intermittent timeout
[test_getUserMedia_peerIdentity.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g)
[test_peerConnection_addIceCandidate.html]
[test_peerConnection_addCandidateInHaveLocalOffer.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_peerConnection_basicAudio.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)

View File

@ -1204,18 +1204,21 @@ PeerConnectionWrapper.prototype = {
return;
}
this.holdIceCandidates.then(() => {
info(this + ": adding ICE candidate " + JSON.stringify(candidate));
return this._pc.addIceCandidate(candidate);
})
.then(() => ok(true, this + " successfully added an ICE candidate"))
.catch(e =>
// The onicecandidate callback runs independent of the test steps
// and therefore errors thrown from in there don't get caught by the
// race of the Promises around our test steps.
// Note: as long as we are queuing ICE candidates until the success
// of sRD() this should never ever happen.
ok(false, this + " adding ICE candidate failed with: " + e.message)
);
this.addIceCandidate(candidate);
});
},
/**
* Adds an ICE candidate and automatically handles the failure case.
*
* @param {object} candidate
* SDP candidate
*/
addIceCandidate : function(candidate) {
info(this + ": adding ICE candidate " + JSON.stringify(candidate));
return this._pc.addIceCandidate(candidate).then(() => {
info(this + ": Successfully added an ICE candidate");
});
},
/**

View File

@ -7,21 +7,21 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1087551",
title: "addCandidate behavior in different states"
bug: "784519",
title: "addCandidate (answer) in 'have-local-offer'"
});
var test;
runNetworkTest(function () {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_GET_ANSWER");
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.insertAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION", [
function PC_LOCAL_ADD_CANDIDATE_EARLY(test) {
test.chain.append([
function PC_LOCAL_ADD_CANDIDATE(test) {
var candidate = new mozRTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 0});
{candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 1});
return test.pcLocal._pc.addIceCandidate(candidate).then(
generateErrorCallback("addIceCandidate should have failed."),
err => {
@ -29,50 +29,6 @@
});
}
]);
test.chain.insertAfter("PC_REMOTE_SET_LOCAL_DESCRIPTION", [
function PC_REMOTE_ADD_CANDIDATE_INVALID_INDEX(test) {
var invalid_index = new mozRTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 2});
return test.pcRemote._pc.addIceCandidate(invalid_index)
.then(
generateErrorCallback("addIceCandidate should have failed."),
err => {
is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError");
}
);
},
function PC_REMOTE_ADD_BOGUS_CANDIDATE(test) {
var bogus = new mozRTCIceCandidate(
{candidate:"Pony Lords, jump!",
sdpMLineIndex: 0});
return test.pcRemote._pc.addIceCandidate(bogus)
.then(
generateErrorCallback("addIceCandidate should have failed."),
err => {
is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError");
}
);
},
function PC_REMOTE_ADD_CANDIDATE_MISSING_INDEX(test) {
// Note: it is probably not a good idea to automatically fill a missing
// MLineIndex with a default value of zero, see bug 1157034
var broken = new mozRTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host"});
return test.pcRemote._pc.addIceCandidate(broken)
.then(
// FIXME this needs to be updated once bug 1157034 is fixed
todo(false, "Missing index in got automatically set to a valid value bz://1157034")
);
},
function PC_REMOTE_ADD_VALID_CANDIDATE(test) {
var candidate = new mozRTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 0});
return test.pcRemote._pc.addIceCandidate(candidate)
.then(ok(true, "Successfully added valid ICE candidate"));
}
]);
test.run();
});
</script>

View File

@ -42,6 +42,16 @@
validateReason);
};
function testAddIceCandidateError() {
var pc = new mozRTCPeerConnection();
info ("Testing addIceCandidate error");
return pc.addIceCandidate(new mozRTCIceCandidate({ candidate: "Pony Lords, jump!",
sdpMid: "whee",
sdpMLineIndex: 1 }))
.then(generateErrorCallback("addIceCandidate with nonsense candidate should fail"),
validateReason);
};
// No test for createOffer errors -- there's nothing we can do at this
// level to evoke an error in createOffer.
@ -49,6 +59,7 @@
testCreateAnswerError()
.then(testSetLocalDescriptionError)
.then(testSetRemoteDescriptionError)
.then(testAddIceCandidateError)
.catch(reason => ok(false, "unexpected error: " + reason))
.then(networkTestFinished);
});

View File

@ -2462,11 +2462,11 @@ JsepSessionImpl::AddCandidateToSdp(Sdp* sdp,
{
if (level >= sdp->GetMediaSectionCount()) {
JSEP_SET_ERROR("Index " << level << " out of range");
return NS_ERROR_INVALID_ARG;
// Ignore
return NS_OK;
}
// Trim off '[a=]candidate:'
// Trim off a=candidate:
size_t begin = candidateUntrimmed.find(':');
if (begin == std::string::npos) {
JSEP_SET_ERROR("Invalid candidate, no ':' (" << candidateUntrimmed << ")");