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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc

Issue 2463343002: Use rtcp class instead of RTCPUtility parser for rtcp_sender_unittest (Closed)
Patch Set: Added check bye packet is present in the test Created 4 years, 1 month 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 | « no previous file | 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_sender_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
index 235c84b09ee4c12b79319d197d4703fea6e2320b..a09d67ad480772a858628f022578dee83f35f5dd 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -12,8 +12,9 @@
#include "webrtc/base/rate_limiter.h"
#include "webrtc/common_types.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
-#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
@@ -23,7 +24,6 @@
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::Invoke;
-using webrtc::RTCPUtility::RtcpCommonHeader;
namespace webrtc {
@@ -790,17 +790,17 @@ TEST_F(RtcpSenderTest, ByeMustBeLast) {
EXPECT_CALL(mock_transport, SendRtcp(_, _))
.WillOnce(Invoke([](const uint8_t* data, size_t len) {
const uint8_t* next_packet = data;
- while (next_packet < data + len) {
- RtcpCommonHeader header;
- RtcpParseCommonHeader(next_packet, len - (next_packet - data), &header);
- next_packet = next_packet +
- header.payload_size_bytes +
- RtcpCommonHeader::kHeaderSizeBytes;
- if (header.packet_type == RTCPUtility::PT_BYE) {
- bool is_last_packet = (data + len == next_packet);
- EXPECT_TRUE(is_last_packet) <<
- "Bye packet should be last in a compound RTCP packet.";
- }
+ const uint8_t* const packet_end = data + len;
+ rtcp::CommonHeader packet;
+ while (next_packet < packet_end) {
+ EXPECT_TRUE(packet.Parse(next_packet, packet_end - next_packet));
+ next_packet = packet.NextPacket();
+ if (packet.type() == rtcp::Bye::kPacketType) // Main test expectation.
+ EXPECT_EQ(0, packet_end - next_packet)
+ << "Bye packet should be last in a compound RTCP packet.";
+ if (next_packet == packet_end) // Validate test was set correctly.
+ EXPECT_EQ(packet.type(), rtcp::Bye::kPacketType)
+ << "Last packet in this test expected to be Bye.";
}
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698