Bug 1396974: make tests ensure no bundle-only is present in inactive m-swctions. r=bwc
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Fri, 08 Sep 2017 13:05:13 -0700
changeset 429984 06c3517b0f33174055a84a04e61878f7d92ce3cf
parent 429983 ae71d517c443ef541b0537a1f9d4eb336e76f583
child 429985 834aca219fbbb10e03cc14bb1cfb591e5b777916
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1396974
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1396974: make tests ensure no bundle-only is present in inactive m-swctions. r=bwc MozReview-Commit-ID: 5pnTygvwTSy
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/src/sdp/SdpAttributeList.h
media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -1002,20 +1002,20 @@ protected:
   void
   ValidateDisabledMSection(const SdpMediaSection* msection)
   {
     ASSERT_EQ(1U, msection->GetFormats().size());
 
     auto& attrs = msection->GetAttributeList();
     ASSERT_TRUE(attrs.HasAttribute(SdpAttribute::kMidAttribute));
     ASSERT_TRUE(attrs.HasAttribute(SdpAttribute::kDirectionAttribute));
+    ASSERT_FALSE(attrs.HasAttribute(SdpAttribute::kBundleOnlyAttribute));
     ASSERT_EQ(SdpDirectionAttribute::kInactive,
               msection->GetDirectionAttribute().mValue);
-    // attribute list is missing a length function to check if these are
-    // all the attributes in it
+    ASSERT_EQ(3U, attrs.Count());
     if (msection->GetMediaType() == SdpMediaSection::kAudio) {
       ASSERT_EQ("0", msection->GetFormats()[0]);
       const SdpRtpmapAttributeList::Rtpmap* rtpmap(msection->FindRtpmap("0"));
       ASSERT_TRUE(rtpmap);
       ASSERT_EQ("0", rtpmap->pt);
       ASSERT_EQ("PCMU", rtpmap->name);
     } else if (msection->GetMediaType() == SdpMediaSection::kVideo) {
       ASSERT_EQ("120", msection->GetFormats()[0]);
--- a/media/webrtc/signaling/src/sdp/SdpAttributeList.h
+++ b/media/webrtc/signaling/src/sdp/SdpAttributeList.h
@@ -36,16 +36,17 @@ public:
 
   virtual bool HasAttribute(AttributeType type, bool sessionFallback) const = 0;
   virtual const SdpAttribute* GetAttribute(AttributeType type,
                                            bool sessionFallback) const = 0;
   // The setter takes an attribute of any type, and takes ownership
   virtual void SetAttribute(SdpAttribute* attr) = 0;
   virtual void RemoveAttribute(AttributeType type) = 0;
   virtual void Clear() = 0;
+  virtual uint32_t Count() const = 0;
 
   virtual const SdpConnectionAttribute& GetConnection() const = 0;
   virtual const SdpOptionsAttribute& GetIceOptions() const = 0;
   virtual const SdpRtcpAttribute& GetRtcp() const = 0;
   virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const = 0;
   virtual const SdpSetupAttribute& GetSetup() const = 0;
   virtual const SdpDtlsMessageAttribute& GetDtlsMessage() const = 0;
 
--- a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
+++ b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp
@@ -65,16 +65,28 @@ SipccSdpAttributeList::RemoveAttribute(A
 void
 SipccSdpAttributeList::Clear()
 {
   for (size_t i = 0; i < kNumAttributeTypes; ++i) {
     RemoveAttribute(static_cast<AttributeType>(i));
   }
 }
 
+uint32_t
+SipccSdpAttributeList::Count() const
+{
+  uint32_t count = 0;
+  for (size_t i = 0; i < kNumAttributeTypes; ++i) {
+    if (mAttributes[i]) {
+      count++;
+    }
+  }
+  return count;
+}
+
 void
 SipccSdpAttributeList::SetAttribute(SdpAttribute* attr)
 {
   if (!IsAllowedHere(attr->GetType())) {
     MOZ_ASSERT(false, "This type of attribute is not allowed here");
     return;
   }
   RemoveAttribute(attr->GetType());
--- a/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h
+++ b/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.h
@@ -32,16 +32,17 @@ public:
 
   virtual bool HasAttribute(AttributeType type,
                             bool sessionFallback) const override;
   virtual const SdpAttribute* GetAttribute(
       AttributeType type, bool sessionFallback) const override;
   virtual void SetAttribute(SdpAttribute* attr) override;
   virtual void RemoveAttribute(AttributeType type) override;
   virtual void Clear() override;
+  virtual uint32_t Count() const override;
 
   virtual const SdpConnectionAttribute& GetConnection() const override;
   virtual const SdpFingerprintAttributeList& GetFingerprint() const
       override;
   virtual const SdpGroupAttributeList& GetGroup() const override;
   virtual const SdpOptionsAttribute& GetIceOptions() const override;
   virtual const SdpRtcpAttribute& GetRtcp() const override;
   virtual const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const