mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784519 - Part 2: Fix success callback event names r=jesup,jsmith
This commit is contained in:
parent
bdbf1a61fa
commit
489544eee4
@ -40,7 +40,6 @@ MOCHITEST_FILES = \
|
||||
test_peerConnection_bug827843.html \
|
||||
test_peerConnection_bug834153.html \
|
||||
test_peerConnection_bug835370.html \
|
||||
test_peerConnection_bug840344.html \
|
||||
head.js \
|
||||
mediaStreamPlayback.js \
|
||||
pc.js \
|
||||
|
@ -1,119 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="head.js"></script>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
bug: "840344",
|
||||
title: "Prevent multiple creations of local SDP"
|
||||
});
|
||||
|
||||
// SDP to stand in for an offer coming from a (theoretical) remote endpoint
|
||||
var offer = {
|
||||
sdp: "v=0\r\n"+
|
||||
"o=Mozilla-SIPUA 23597 0 IN IP4 0.0.0.0\r\n"+
|
||||
"s=SIP Call\r\n"+
|
||||
"t=0 0\r\n"+
|
||||
"a=ice-ufrag:f5fda439\r\n"+
|
||||
"a=ice-pwd:d0df8e2904bdbd29587966e797655970\r\n"+
|
||||
"a=fingerprint:sha-256 DF:69:78:20:8D:2E:08:CE:49:82:A3:11:79:1D:BF:"+
|
||||
"B5:49:49:2D:32:82:2F:0D:88:84:A7:C6:63:23:63:A9:0F\r\n"+
|
||||
"m=audio 52757 RTP/SAVPF 109 0 8 101\r\n"+
|
||||
"c=IN IP4 192.168.129.33\r\n"+
|
||||
"a=rtpmap:109 opus/48000/2\r\n"+
|
||||
"a=ptime:20\r\n"+
|
||||
"a=rtpmap:0 PCMU/8000\r\n"+
|
||||
"a=rtpmap:8 PCMA/8000\r\n"+
|
||||
"a=rtpmap:101 telephone-event/8000\r\n"+
|
||||
"a=fmtp:101 0-15\r\n"+
|
||||
"a=sendrecv\r\n"+
|
||||
"a=candidate:0 1 UDP 2113601791 192.168.129.33 52757 typ host\r\n"+
|
||||
"a=candidate:0 2 UDP 2113601790 192.168.129.33 59738 typ host\r\n"+
|
||||
"m=video 63901 RTP/SAVPF 120\r\n"+
|
||||
"c=IN IP4 192.168.129.33\r\n"+
|
||||
"a=rtpmap:120 VP8/90000\r\n"+
|
||||
"a=sendrecv\r\n"+
|
||||
"a=candidate:0 1 UDP 2113601791 192.168.129.33 63901 typ host\r\n"+
|
||||
"a=candidate:0 2 UDP 2113601790 192.168.129.33 54165 typ host\r\n"+
|
||||
"m=application 65080 SCTP/DTLS 5000 \r\n"+
|
||||
"c=IN IP4 192.168.129.33\r\n"+
|
||||
"a=fmtp:5000 protocol=webrtc-datachannel;streams=16\r\n"+
|
||||
"a=sendrecv\r\n"+
|
||||
"a=candidate:0 1 UDP 2113601791 192.168.129.33 65080 typ host\r\n"+
|
||||
"a=candidate:0 2 UDP 2113601790 192.168.129.33 62658 typ host\r\n",
|
||||
type: "offer"
|
||||
};
|
||||
|
||||
var steps = [
|
||||
[
|
||||
"SET_REMOTE_DESCRIPTION",
|
||||
function (test) {
|
||||
test.pcLocal.setRemoteDescription(new mozRTCSessionDescription(offer),
|
||||
function () {
|
||||
test.next();
|
||||
});
|
||||
}
|
||||
],
|
||||
[
|
||||
"CHECK_MULTIPLE_ANSWERS",
|
||||
function (test) {
|
||||
var answerCount = 0;
|
||||
var setLocalCount = 0;
|
||||
|
||||
info("Create answer #1");
|
||||
test.pcLocal.createAnswer(answerSuccess);
|
||||
|
||||
info("Create answer #2");
|
||||
test.pcLocal.createAnswer(answerSuccess);
|
||||
|
||||
|
||||
// Fourth: Count the answers and push them into the local description
|
||||
function answerSuccess(answer) {
|
||||
answerCount++;
|
||||
ok (answerCount < 3, "Answer count is less than three.")
|
||||
|
||||
info("Got answer #" + answerCount);
|
||||
is(answer.type, 'answer', "Answer is of type 'answer'");
|
||||
ok(answer.sdp.length > 10, "Answer has length " + answer.sdp.length);
|
||||
|
||||
info("Set local description for answer #" + answerCount);
|
||||
test.pcLocal.setLocalDescription(answer, setLocalSuccess);
|
||||
}
|
||||
|
||||
// Fifth: Once we have two successful rounds through here, we're done.
|
||||
function setLocalSuccess() {
|
||||
setLocalCount++;
|
||||
|
||||
info("Set local description #" + setLocalCount);
|
||||
// Then shalt thou count to two, no more, no less. Two shall be the
|
||||
// number thou shalt count, and the number of the counting shall be
|
||||
// two. Three shalt thou not count, neither count thou one, excepting
|
||||
// that thou then proceed to two. Four is right out. Once the number two,
|
||||
// being the second number, be reached, then thou shalt declare success.
|
||||
ok (setLocalCount < 3, "Set local count is less than three.")
|
||||
if (setLocalCount === 2) {
|
||||
is (answerCount, 2, "Answer count is 2.")
|
||||
test.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
var test;
|
||||
runTest(function () {
|
||||
test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([{audio: true, video: true}], [ ]);
|
||||
test.chain.replaceAfter("PC_LOCAL_GUM", steps);
|
||||
test.run();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -135,7 +135,7 @@ public:
|
||||
mRemoteStream = mPC->media()->GetRemoteStream(streams->media_stream_id);
|
||||
MOZ_ASSERT(mRemoteStream);
|
||||
}
|
||||
if ((mCallState == CREATEOFFER) || (mCallState == CREATEANSWER)) {
|
||||
if ((mCallState == CREATEOFFERSUCCESS) || (mCallState == CREATEANSWERSUCCESS)) {
|
||||
mSdpStr = aInfo->getSDP();
|
||||
}
|
||||
}
|
||||
@ -165,11 +165,11 @@ public:
|
||||
}
|
||||
|
||||
switch (mCallState) {
|
||||
case CREATEOFFER:
|
||||
case CREATEOFFERSUCCESS:
|
||||
mObserver->OnCreateOfferSuccess(mSdpStr.c_str());
|
||||
break;
|
||||
|
||||
case CREATEANSWER:
|
||||
case CREATEANSWERSUCCESS:
|
||||
mObserver->OnCreateAnswerSuccess(mSdpStr.c_str());
|
||||
break;
|
||||
|
||||
@ -181,7 +181,7 @@ public:
|
||||
mObserver->OnCreateAnswerError(mCode, mReason.c_str());
|
||||
break;
|
||||
|
||||
case SETLOCALDESC:
|
||||
case SETLOCALDESCSUCCESS:
|
||||
// TODO: The SDP Parse error list should be copied out and sent up
|
||||
// to the Javascript layer before being cleared here. Even though
|
||||
// there was not a failure, it is possible that the SDP parse generated
|
||||
@ -191,7 +191,7 @@ public:
|
||||
mObserver->OnSetLocalDescriptionSuccess();
|
||||
break;
|
||||
|
||||
case SETREMOTEDESC:
|
||||
case SETREMOTEDESCSUCCESS:
|
||||
// TODO: The SDP Parse error list should be copied out and sent up
|
||||
// to the Javascript layer before being cleared here. Even though
|
||||
// there was not a failure, it is possible that the SDP parse generated
|
||||
@ -1274,12 +1274,12 @@ PeerConnectionImpl::onCallEvent(ccapi_call_event_e aCallEvent,
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case SETLOCALDESC:
|
||||
case SETLOCALDESCSUCCESS:
|
||||
case UPDATELOCALDESC:
|
||||
mLocalSDP = aInfo->getSDP();
|
||||
break;
|
||||
|
||||
case SETREMOTEDESC:
|
||||
case SETREMOTEDESCSUCCESS:
|
||||
case ADDICECANDIDATE:
|
||||
mRemoteSDP = aInfo->getSDP();
|
||||
break;
|
||||
|
@ -3156,7 +3156,7 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
return (fsmdef_release(fcb, cause, FALSE));
|
||||
}
|
||||
|
||||
ui_create_offer(evCreateOffer, line, call_id,
|
||||
ui_create_offer(evCreateOfferSuccess, line, call_id,
|
||||
dcb->caller_id.call_instance_id,
|
||||
strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL);
|
||||
free(local_sdp);
|
||||
@ -3228,7 +3228,7 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
dcb->local_sdp_complete = TRUE;
|
||||
|
||||
/* Pass offer SDP back to UI */
|
||||
ui_create_offer(evCreateOffer, line, call_id,
|
||||
ui_create_offer(evCreateOfferSuccess, line, call_id,
|
||||
dcb->caller_id.call_instance_id,
|
||||
strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL);
|
||||
cc_free_msg_body_parts(&msg_body);
|
||||
@ -3298,7 +3298,7 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
return (fsmdef_release(fcb, cause, FALSE));
|
||||
}
|
||||
|
||||
ui_create_answer(evCreateAnswer, line, call_id,
|
||||
ui_create_answer(evCreateAnswerSuccess, line, call_id,
|
||||
dcb->caller_id.call_instance_id,
|
||||
strlib_malloc(local_sdp,-1), PC_NO_ERROR, NULL);
|
||||
free(local_sdp);
|
||||
@ -3398,7 +3398,7 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
dcb->local_sdp_complete = TRUE;
|
||||
|
||||
/* Pass SDP back to UI */
|
||||
ui_create_answer(evCreateAnswer, line, call_id,
|
||||
ui_create_answer(evCreateAnswerSuccess, line, call_id,
|
||||
dcb->caller_id.call_instance_id,
|
||||
strlib_malloc(msg_body.parts[0].body, -1), PC_NO_ERROR, NULL);
|
||||
cc_free_msg_body_parts(&msg_body);
|
||||
@ -3555,7 +3555,7 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) {
|
||||
return (SM_RC_END);
|
||||
}
|
||||
|
||||
ui_set_local_description(evSetLocalDesc, msg->line, msg->call_id,
|
||||
ui_set_local_description(evSetLocalDescSuccess, msg->line, msg->call_id,
|
||||
dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
|
||||
PC_NO_ERROR, NULL);
|
||||
|
||||
@ -3781,7 +3781,7 @@ fsmdef_ev_setremotedesc(sm_event_t *event) {
|
||||
return (SM_RC_END);
|
||||
}
|
||||
|
||||
ui_set_remote_description(evSetRemoteDesc, line, call_id,
|
||||
ui_set_remote_description(evSetRemoteDescSuccess, line, call_id,
|
||||
dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1),
|
||||
PC_NO_ERROR, NULL);
|
||||
|
||||
|
@ -31,12 +31,12 @@ typedef enum {
|
||||
evHoldRevert = HOLDREVERT,
|
||||
evWhisper = WHISPER,
|
||||
evWaitingForDigits = WAITINGFORDIGITS,
|
||||
evCreateOffer = CREATEOFFER,
|
||||
evCreateAnswer = CREATEANSWER,
|
||||
evCreateOfferSuccess = CREATEOFFERSUCCESS,
|
||||
evCreateAnswerSuccess = CREATEANSWERSUCCESS,
|
||||
evCreateOfferError = CREATEOFFERERROR,
|
||||
evCreateAnswerError = CREATEANSWERERROR,
|
||||
evSetLocalDesc = SETLOCALDESC,
|
||||
evSetRemoteDesc = SETREMOTEDESC,
|
||||
evSetLocalDescSuccess = SETLOCALDESCSUCCESS,
|
||||
evSetRemoteDescSuccess = SETREMOTEDESCSUCCESS,
|
||||
evUpdateLocalDesc = UPDATELOCALDESC,
|
||||
evSetLocalDescError = SETLOCALDESCERROR,
|
||||
evSetRemoteDescError = SETREMOTEDESCERROR,
|
||||
|
@ -276,12 +276,12 @@ typedef enum {
|
||||
WHISPER,
|
||||
PRESERVATION,
|
||||
WAITINGFORDIGITS = 21,
|
||||
CREATEOFFER,
|
||||
CREATEANSWER,
|
||||
CREATEOFFERSUCCESS,
|
||||
CREATEANSWERSUCCESS,
|
||||
CREATEOFFERERROR,
|
||||
CREATEANSWERERROR,
|
||||
SETLOCALDESC,
|
||||
SETREMOTEDESC,
|
||||
SETLOCALDESCSUCCESS,
|
||||
SETREMOTEDESCSUCCESS,
|
||||
UPDATELOCALDESC,
|
||||
UPDATEREMOTEDESC,
|
||||
SETLOCALDESCERROR,
|
||||
|
@ -115,11 +115,11 @@ std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state)
|
||||
case WAITINGFORDIGITS:
|
||||
statestr = "WAITINGFORDIGITS";
|
||||
break;
|
||||
case CREATEOFFER:
|
||||
statestr = "CREATEOFFER";
|
||||
case CREATEOFFERSUCCESS:
|
||||
statestr = "CREATEOFFERSUCCESS";
|
||||
break;
|
||||
case CREATEANSWER:
|
||||
statestr = "CREATEANSWER";
|
||||
case CREATEANSWERSUCCESS:
|
||||
statestr = "CREATEANSWERSUCCESS";
|
||||
break;
|
||||
case CREATEOFFERERROR:
|
||||
statestr = "CREATEOFFERERROR";
|
||||
@ -127,11 +127,11 @@ std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state)
|
||||
case CREATEANSWERERROR:
|
||||
statestr = "CREATEANSWERERROR";
|
||||
break;
|
||||
case SETLOCALDESC:
|
||||
statestr = "SETLOCALDESC";
|
||||
case SETLOCALDESCSUCCESS:
|
||||
statestr = "SETLOCALDESCSUCCESS";
|
||||
break;
|
||||
case SETREMOTEDESC:
|
||||
statestr = "SETREMOTEDESC";
|
||||
case SETREMOTEDESCSUCCESS:
|
||||
statestr = "SETREMOTEDESCSUCCESS";
|
||||
break;
|
||||
case UPDATELOCALDESC:
|
||||
statestr = "UPDATELOCALDESC";
|
||||
|
@ -146,13 +146,6 @@ public:
|
||||
ANSWER
|
||||
};
|
||||
|
||||
enum StateType {
|
||||
kReadyState,
|
||||
kIceState,
|
||||
kSdpState,
|
||||
kSipccState
|
||||
};
|
||||
|
||||
enum ResponseState {
|
||||
stateNoResponse,
|
||||
stateSuccess,
|
||||
@ -293,21 +286,21 @@ TestObserver::OnStateChange(uint32_t state_type)
|
||||
|
||||
switch (state_type)
|
||||
{
|
||||
case kReadyState:
|
||||
case IPeerConnectionObserver::kReadyState:
|
||||
rv = pc->GetReadyState(&gotstate);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
cout << "Ready State: " << gotstate << endl;
|
||||
break;
|
||||
case kIceState:
|
||||
case IPeerConnectionObserver::kIceState:
|
||||
rv = pc->GetIceState(&gotstate);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
cout << "ICE State: " << gotstate << endl;
|
||||
break;
|
||||
case kSdpState:
|
||||
case IPeerConnectionObserver::kSdpState:
|
||||
cout << "SDP State: " << endl;
|
||||
// NS_ENSURE_SUCCESS(rv, rv);
|
||||
break;
|
||||
case kSipccState:
|
||||
case IPeerConnectionObserver::kSipccState:
|
||||
rv = pc->GetSipccState(&gotstate);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
cout << "SIPCC State: " << gotstate << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user