Bug 1300863 - Part 1: Test case. r?drno draft
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 14 Sep 2016 16:56:53 -0500
changeset 415652 b3daf8a3a104276ec7268a86c8af6f5d0f11de31
parent 415495 62f79d676e0e11b3ad59a5425b3ebb3ec5bbefb5
child 415653 2bbba65fbe20ef46358f8fa94a528dbb2fd65ee8
push id29924
push userbcampen@mozilla.com
push dateTue, 20 Sep 2016 19:34:30 +0000
reviewersdrno
bugs1300863
milestone52.0a1
Bug 1300863 - Part 1: Test case. r?drno MozReview-Commit-ID: AVfxKo9K8vg
media/webrtc/signaling/test/jsep_session_unittest.cpp
--- 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);