Bug 1300863 - Part 1: Test case. r?drno
MozReview-Commit-ID: AVfxKo9K8vg
--- a/media/webrtc/signaling/test/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/test/jsep_session_unittest.cpp
@@ -1503,53 +1503,49 @@ TEST_P(JsepSessionTest, RenegotiationBot
// First m-section should be recvonly
auto offer = GetParsedLocalDescription(mSessionOff);
auto* msection = GetMsection(*offer, types.front(), 0);
ASSERT_TRUE(msection);
ASSERT_TRUE(msection->IsReceiving());
ASSERT_FALSE(msection->IsSending());
- // First m-section should be inactive, and rejected
+ // First m-section should be inactive, but not rejected
auto answer = GetParsedLocalDescription(mSessionAns);
msection = GetMsection(*answer, types.front(), 0);
ASSERT_TRUE(msection);
ASSERT_FALSE(msection->IsReceiving());
ASSERT_FALSE(msection->IsSending());
- ASSERT_FALSE(msection->GetPort());
+ ASSERT_TRUE(msection->GetPort());
auto newOffererPairs = GetTrackPairsByLevel(mSessionOff);
auto newAnswererPairs = GetTrackPairsByLevel(mSessionAns);
ASSERT_EQ(offererPairs.size(), newOffererPairs.size() + 1);
for (size_t i = 0; i < newOffererPairs.size(); ++i) {
JsepTrackPair oldPair(offererPairs[i + 1]);
JsepTrackPair newPair(newOffererPairs[i]);
ASSERT_EQ(oldPair.mLevel, newPair.mLevel);
ASSERT_EQ(oldPair.mSending.get(), newPair.mSending.get());
ASSERT_EQ(oldPair.mReceiving.get(), newPair.mReceiving.get());
ASSERT_TRUE(oldPair.mBundleLevel.isSome());
ASSERT_TRUE(newPair.mBundleLevel.isSome());
- ASSERT_EQ(0U, *oldPair.mBundleLevel);
- ASSERT_EQ(1U, *newPair.mBundleLevel);
}
ASSERT_EQ(answererPairs.size(), newAnswererPairs.size() + 1);
for (size_t i = 0; i < newAnswererPairs.size(); ++i) {
JsepTrackPair oldPair(answererPairs[i + 1]);
JsepTrackPair newPair(newAnswererPairs[i]);
ASSERT_EQ(oldPair.mLevel, newPair.mLevel);
ASSERT_EQ(oldPair.mSending.get(), newPair.mSending.get());
ASSERT_EQ(oldPair.mReceiving.get(), newPair.mReceiving.get());
ASSERT_TRUE(oldPair.mBundleLevel.isSome());
ASSERT_TRUE(newPair.mBundleLevel.isSome());
- ASSERT_EQ(0U, *oldPair.mBundleLevel);
- ASSERT_EQ(1U, *newPair.mBundleLevel);
}
}
TEST_P(JsepSessionTest, RenegotiationBothRemoveThenAddTrack)
{
AddTracks(mSessionOff);
AddTracks(mSessionAns);
if (types.front() == SdpMediaSection::kApplication) {
@@ -2666,16 +2662,17 @@ TEST_F(JsepSessionTest, OfferToReceiveAu
UniquePtr<Sdp> answer(Parse(mSessionAns.GetLocalDescription()));
ASSERT_TRUE(answer.get());
ASSERT_EQ(1U, answer->GetMediaSectionCount());
ASSERT_EQ(SdpMediaSection::kAudio,
answer->GetMediaSection(0).GetMediaType());
ASSERT_EQ(SdpDirectionAttribute::kInactive,
answer->GetMediaSection(0).GetAttributeList().GetDirection());
+ ASSERT_NE(0U, answer->GetMediaSection(0).GetPort());
}
TEST_F(JsepSessionTest, OfferToReceiveVideoNotUsed)
{
JsepOfferOptions options;
options.mOfferToReceiveVideo = Some<size_t>(1);
OfferAnswer(CHECK_SUCCESS, Some(options));
@@ -2690,16 +2687,17 @@ TEST_F(JsepSessionTest, OfferToReceiveVi
UniquePtr<Sdp> answer(Parse(mSessionAns.GetLocalDescription()));
ASSERT_TRUE(answer.get());
ASSERT_EQ(1U, answer->GetMediaSectionCount());
ASSERT_EQ(SdpMediaSection::kVideo,
answer->GetMediaSection(0).GetMediaType());
ASSERT_EQ(SdpDirectionAttribute::kInactive,
answer->GetMediaSection(0).GetAttributeList().GetDirection());
+ ASSERT_NE(0U, answer->GetMediaSection(0).GetPort());
}
TEST_F(JsepSessionTest, CreateOfferNoDatachannelDefault)
{
RefPtr<JsepTrack> msta(
new JsepTrack(SdpMediaSection::kAudio, "offerer_stream", "a1"));
mSessionOff.AddTrack(msta);