Bug 1016476 - Part 2: Test work. r=drno

This commit is contained in:
Byron Campen [:bwc] 2014-11-25 17:36:16 -08:00
parent 884d5704bd
commit 404d84f2d4
6 changed files with 432 additions and 133 deletions

View File

@ -16,6 +16,8 @@ support-files =
skip-if = toolkit == 'gonk' # Bug 962984 for debug, bug 963244 for opt
[test_dataChannel_basicAudioVideo.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_dataChannel_basicAudioVideoNoBundle.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_dataChannel_basicAudioVideoCombined.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_dataChannel_basicDataOnly.html]

View File

@ -176,19 +176,25 @@ var commandsPeerConnection = [
test.createOffer(test.pcLocal, function (offer) {
is(test.pcLocal.signalingState, STABLE,
"Local create offer does not change signaling state");
if (test.steeplechase) {
send_message({"type": "offer",
"offer": test.originalOffer,
"offer_constraints": test.pcLocal.constraints,
"offer_options": test.pcLocal.offerOptions});
test._local_offer = test.originalOffer;
test._offer_constraints = test.pcLocal.constraints;
test._offer_options = test.pcLocal.offerOptions;
}
test.next();
});
}
],
[
'PC_LOCAL_STEEPLECHASE_SIGNAL_OFFER',
function (test) {
if (test.steeplechase) {
send_message({"type": "offer",
"offer": test.originalOffer,
"offer_constraints": test.pcLocal.constraints,
"offer_options": test.pcLocal.offerOptions});
test._local_offer = test.originalOffer;
test._offer_constraints = test.pcLocal.constraints;
test._offer_options = test.pcLocal.offerOptions;
}
test.next();
}
],
[
'PC_LOCAL_SET_LOCAL_DESCRIPTION',
function (test) {
@ -835,19 +841,25 @@ var commandsDataChannel = [
"Local create offer does not change signaling state");
ok(offer.sdp.contains("m=application"),
"m=application is contained in the SDP");
if (test.steeplechase) {
send_message({"type": "offer",
"offer": test.originalOffer,
"offer_constraints": test.pcLocal.constraints,
"offer_options": test.pcLocal.offerOptions});
test._local_offer = test.pcLocal._last_offer;
test._offer_constraints = test.pcLocal.constraints;
test._offer_options = test.pcLocal.offerOptions;
}
test.next();
});
}
],
[
'PC_LOCAL_STEEPLECHASE_SIGNAL_OFFER',
function (test) {
if (test.steeplechase) {
send_message({"type": "offer",
"offer": test.originalOffer,
"offer_constraints": test.pcLocal.constraints,
"offer_options": test.pcLocal.offerOptions});
test._local_offer = test.originalOffer;
test._offer_constraints = test.pcLocal.constraints;
test._offer_options = test.pcLocal.offerOptions;
}
test.next();
}
],
[
'PC_LOCAL_SET_LOCAL_DESCRIPTION',
function (test) {

View File

@ -0,0 +1,44 @@
<!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>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
SimpleTest.requestFlakyTimeout("untriaged");
createHTML({
bug: "1016476",
title: "Basic data channel audio/video connection without bundle"
});
var test;
runNetworkTest(function () {
test = new DataChannelTest();
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.chain.insertAfter("PC_LOCAL_CREATE_OFFER",
[[
'PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER',
function (test) {
// Just replace a=group:BUNDLE with something that will be ignored.
test.originalOffer.sdp = test.originalOffer.sdp.replace(
"a=group:BUNDLE",
"a=foo:");
test.next();
}
]]
);
test.run();
});
</script>
</pre>
</body>
</html>

View File

@ -1200,6 +1200,62 @@ TEST_F(JsepSessionTest, TestRtcpFbStar)
}
}
TEST_F(JsepSessionTest, TestUniquePayloadTypes)
{
// The audio payload types will all appear more than once, but the video
// payload types will be unique.
AddTracks(&mSessionOff, "audio,audio,video");
AddTracks(&mSessionAns, "audio,audio,video");
std::string offer = CreateOffer();
SetLocalOffer(offer, CHECK_SUCCESS);
SetRemoteOffer(offer, CHECK_SUCCESS);
std::string answer = CreateAnswer();
SetLocalAnswer(answer, CHECK_SUCCESS);
SetRemoteAnswer(answer, CHECK_SUCCESS);
ASSERT_EQ(3U, mSessionOff.GetNegotiatedTrackPairCount());
ASSERT_EQ(3U, mSessionAns.GetNegotiatedTrackPairCount());
const JsepTrackPair* pair;
ASSERT_EQ(NS_OK, mSessionOff.GetNegotiatedTrackPair(0, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_EQ(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
ASSERT_EQ(NS_OK, mSessionOff.GetNegotiatedTrackPair(1, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_EQ(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
ASSERT_EQ(NS_OK, mSessionOff.GetNegotiatedTrackPair(2, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_NE(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
ASSERT_EQ(NS_OK, mSessionAns.GetNegotiatedTrackPair(0, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_EQ(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
ASSERT_EQ(NS_OK, mSessionAns.GetNegotiatedTrackPair(1, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_EQ(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
ASSERT_EQ(NS_OK, mSessionAns.GetNegotiatedTrackPair(2, &pair));
ASSERT_TRUE(pair->mReceiving);
ASSERT_TRUE(pair->mReceiving->GetNegotiatedDetails());
ASSERT_NE(0U,
pair->mReceiving->GetNegotiatedDetails()->GetUniquePayloadTypes().size());
}
} // namespace mozilla
int

View File

@ -1159,6 +1159,7 @@ const std::string kBasicAudioVideoOffer =
"a=candidate:6 2 UDP 16515070 162.222.183.171 50340 typ relay raddr 162.222.183.171 rport 50340" CRLF
"a=candidate:0 2 UDP 2130379006 10.0.0.36 55428 typ host" CRLF
"a=end-of-candidates" CRLF
"a=ssrc:5150" CRLF
"m=video 9 RTP/SAVPF 120" CRLF
"c=IN IP6 ::1" CRLF
"a=mid:second" CRLF
@ -1181,6 +1182,8 @@ const std::string kBasicAudioVideoOffer =
"a=candidate:3 1 UDP 100401151 162.222.183.171 62935 typ relay raddr 162.222.183.171 rport 62935" CRLF
"a=candidate:3 2 UDP 100401150 162.222.183.171 61026 typ relay raddr 162.222.183.171 rport 61026" CRLF
"a=end-of-candidates" CRLF
"a=ssrc:1111 foo" CRLF
"a=ssrc:1111 foo:bar" CRLF
"m=audio 9 RTP/SAVPF 0" CRLF
"a=mid:third" CRLF
"a=rtpmap:0 PCMU/8000" CRLF
@ -1329,6 +1332,29 @@ TEST_P(NewSdpTest, CheckSetup) {
SdpAttribute::kSetupAttribute));
}
TEST_P(NewSdpTest, CheckSsrc)
{
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(mSdp) << "Parse failed: " << GetParseErrors();
ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections";
ASSERT_TRUE(mSdp->GetMediaSection(0).GetAttributeList().HasAttribute(
SdpAttribute::kSsrcAttribute));
auto ssrcs = mSdp->GetMediaSection(0).GetAttributeList().GetSsrc().mSsrcs;
ASSERT_EQ(1U, ssrcs.size());
ASSERT_EQ(5150U, ssrcs[0].ssrc);
ASSERT_EQ("", ssrcs[0].attribute);
ASSERT_TRUE(mSdp->GetMediaSection(1).GetAttributeList().HasAttribute(
SdpAttribute::kSsrcAttribute));
ssrcs = mSdp->GetMediaSection(1).GetAttributeList().GetSsrc().mSsrcs;
ASSERT_EQ(2U, ssrcs.size());
ASSERT_EQ(1111U, ssrcs[0].ssrc);
ASSERT_EQ("foo", ssrcs[0].attribute);
ASSERT_EQ(1111U, ssrcs[1].ssrc);
ASSERT_EQ("foo:bar", ssrcs[1].attribute);
}
TEST_P(NewSdpTest, CheckRtpmap) {
ParseSdp(kBasicAudioVideoOffer);
ASSERT_TRUE(mSdp) << "Parse failed: " << GetParseErrors();

File diff suppressed because it is too large Load Diff