Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc

Issue 1811933002: [rtcp] Pli::Parse updated not to use RTCPUtility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
index 09e8f5898f561ea6b37c05c71ec527cfe8358cb3..4304f191d5c9356ba15a454df734c1ae52cf0017 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
@@ -10,30 +10,28 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
+#include "webrtc/test/rtcp_packet_parser.h"
+
+using testing::ElementsAreArray;
+using testing::make_tuple;
using webrtc::rtcp::Pli;
-using webrtc::RTCPUtility::RtcpCommonHeader;
-using webrtc::RTCPUtility::RtcpParseCommonHeader;
namespace webrtc {
namespace {
-
const uint32_t kSenderSsrc = 0x12345678;
const uint32_t kRemoteSsrc = 0x23456789;
// Manually created Pli packet matching constants above.
const uint8_t kPacket[] = {0x81, 206, 0x00, 0x02,
0x12, 0x34, 0x56, 0x78,
0x23, 0x45, 0x67, 0x89};
-const size_t kPacketLength = sizeof(kPacket);
+} // namespace
TEST(RtcpPacketPliTest, Parse) {
- RtcpCommonHeader header;
- EXPECT_TRUE(RtcpParseCommonHeader(kPacket, kPacketLength, &header));
Pli mutable_parsed;
- EXPECT_TRUE(mutable_parsed.Parse(
- header, kPacket + RtcpCommonHeader::kHeaderSizeBytes));
+ EXPECT_TRUE(test::ParseSinglePacket(kPacket, &mutable_parsed));
const Pli& parsed = mutable_parsed; // Read values from constant object.
EXPECT_EQ(kSenderSsrc, parsed.sender_ssrc());
@@ -47,19 +45,16 @@ TEST(RtcpPacketPliTest, Create) {
rtc::Buffer packet = pli.Build();
- ASSERT_EQ(kPacketLength, packet.size());
- EXPECT_EQ(0, memcmp(kPacket, packet.data(), kPacketLength));
+ EXPECT_THAT(make_tuple(packet.data(), packet.size()),
+ ElementsAreArray(kPacket));
}
TEST(RtcpPacketPliTest, ParseFailsOnTooSmallPacket) {
- RtcpCommonHeader header;
- EXPECT_TRUE(RtcpParseCommonHeader(kPacket, kPacketLength, &header));
- header.payload_size_bytes--;
+ const uint8_t kTooSmallPacket[] = {0x81, 206, 0x00, 0x01,
+ 0x12, 0x34, 0x56, 0x78};
Pli parsed;
- EXPECT_FALSE(
- parsed.Parse(header, kPacket + RtcpCommonHeader::kHeaderSizeBytes));
+ EXPECT_FALSE(test::ParseSinglePacket(kTooSmallPacket, &parsed));
}
-} // namespace
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698