Bug 1148004: Test case for media-level fingerprint attribute, as well as session-level fallback. r=jesup
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 26 Mar 2015 10:59:18 -0700
changeset 266647 d7f990fd97f61fce199489f7cc676f0221bf75f3
parent 266646 e7db788bc37277caeb43434c1eaddd9607c3b616
child 266648 6dd46eb4124acaeec9c50000e950d7531dd6111d
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1148004
milestone39.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 1148004: Test case for media-level fingerprint attribute, as well as session-level fallback. r=jesup
media/webrtc/signaling/test/sdp_unittests.cpp
--- a/media/webrtc/signaling/test/sdp_unittests.cpp
+++ b/media/webrtc/signaling/test/sdp_unittests.cpp
@@ -1158,16 +1158,17 @@ const std::string kBasicAudioVideoOffer 
 "a=candidate:3 2 UDP 100401150 162.222.183.171 62454 typ relay raddr 162.222.183.171 rport 62454" CRLF
 "a=candidate:2 2 UDP 1694236670 24.6.134.204 55428 typ srflx raddr 10.0.0.36 rport 55428" CRLF
 "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 121" CRLF
 "c=IN IP6 ::1" CRLF
+"a=fingerprint:sha-1 DF:FA:FB:08:3B:3C:54:1D:D7:D4:05:77:A0:72:9B:14:08:6D:0F:4C:2E:AC:8A:FD:0A:8E:99:BF:5D:E8:3C:E7" CRLF
 "a=mid:second" CRLF
 "a=rtpmap:120 VP8/90000" CRLF
 "a=fmtp:120 max-fs=3600;max-fr=30" CRLF
 "a=rtpmap:121 VP9/90000" CRLF
 "a=fmtp:121 max-fs=3600;max-fr=30" CRLF
 "a=recvonly" CRLF
 "a=rtcp-fb:120 nack" CRLF
 "a=rtcp-fb:120 nack pli" CRLF
@@ -1269,16 +1270,50 @@ TEST_P(NewSdpTest, CheckFingerprint) {
     << "Wrong hash function";
   ASSERT_EQ("DF:2E:AC:8A:FD:0A:8E:99:BF:5D:E8:3C:E7:FA:FB:08:"
             "3B:3C:54:1D:D7:D4:05:77:A0:72:9B:14:08:6D:0F:4C",
             SdpFingerprintAttributeList::FormatFingerprint(
                 fingerprints.mFingerprints[0].fingerprint))
     << "Wrong fingerprint";
   ASSERT_EQ(0xdfU, fingerprints.mFingerprints[0].fingerprint[0])
       << "first fingerprint element is iffy";
+
+  ASSERT_EQ(3U, mSdp->GetMediaSectionCount());
+
+  // Fallback to session level
+  ASSERT_TRUE(mSdp->GetMediaSection(0).GetAttributeList().HasAttribute(
+        SdpAttribute::kFingerprintAttribute));
+  fingerprints = mSdp->GetMediaSection(0).GetAttributeList().GetFingerprint();
+  ASSERT_EQ(1U, fingerprints.mFingerprints.size());
+  ASSERT_EQ(SdpFingerprintAttributeList::kSha256,
+      fingerprints.mFingerprints[0].hashFunc)
+    << "Wrong hash function";
+  ASSERT_EQ("DF:2E:AC:8A:FD:0A:8E:99:BF:5D:E8:3C:E7:FA:FB:08:"
+            "3B:3C:54:1D:D7:D4:05:77:A0:72:9B:14:08:6D:0F:4C",
+            SdpFingerprintAttributeList::FormatFingerprint(
+                fingerprints.mFingerprints[0].fingerprint))
+    << "Wrong fingerprint";
+  ASSERT_EQ(0xdfU, fingerprints.mFingerprints[0].fingerprint[0])
+      << "first fingerprint element is iffy";
+
+  // Media level
+  ASSERT_TRUE(mSdp->GetMediaSection(1).GetAttributeList().HasAttribute(
+        SdpAttribute::kFingerprintAttribute));
+  fingerprints = mSdp->GetMediaSection(1).GetAttributeList().GetFingerprint();
+  ASSERT_EQ(1U, fingerprints.mFingerprints.size());
+  ASSERT_EQ(SdpFingerprintAttributeList::kSha1,
+      fingerprints.mFingerprints[0].hashFunc)
+    << "Wrong hash function";
+  ASSERT_EQ("DF:FA:FB:08:3B:3C:54:1D:D7:D4:05:77:A0:72:9B:14:"
+            "08:6D:0F:4C:2E:AC:8A:FD:0A:8E:99:BF:5D:E8:3C:E7",
+            SdpFingerprintAttributeList::FormatFingerprint(
+                fingerprints.mFingerprints[0].fingerprint))
+    << "Wrong fingerprint";
+  ASSERT_EQ(0xdfU, fingerprints.mFingerprints[0].fingerprint[0])
+      << "first fingerprint element is iffy";
 }
 
 TEST_P(NewSdpTest, CheckIdentity) {
   ParseSdp(kBasicAudioVideoOffer);
   ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
   ASSERT_TRUE(mSdp->GetAttributeList().HasAttribute(
         SdpAttribute::kIdentityAttribute));
   auto identity = mSdp->GetAttributeList().GetIdentity();