// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cast/streaming/impl/compound_rtcp_builder.h" #include <algorithm> #include <chrono> #include "cast/streaming/impl/compound_rtcp_parser.h" #include "cast/streaming/public/constants.h" #include "cast/streaming/impl/rtcp_session.h" #include "cast/streaming/testing/mock_compound_rtcp_parser_client.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "platform/api/time.h" #include "util/chrono_helpers.h" _; Invoke; Mock; SaveArg; StrictMock; namespace openscreen::cast { namespace { constexpr Ssrc kSenderSsrc{ … }; constexpr Ssrc kReceiverSsrc{ … }; class CompoundRtcpBuilderTest : public testing::Test { … }; // Tests that the builder, by default, produces RTCP packets that always include // the receiver's reference time and checkpoint information. TEST_F(CompoundRtcpBuilderTest, TheBasics) { … } // Tests that the builder correctly serializes a Receiver Report Block and // includes it only in the next-built RTCP packet. TEST_F(CompoundRtcpBuilderTest, WithReceiverReportBlock) { … } // Tests that the builder repeatedly produces packets with the PLI message as // long as the PLI flag is set, and produces packets without the PLI message // while the flag is not set. TEST_F(CompoundRtcpBuilderTest, WithPictureLossIndicator) { … } // Tests that the builder produces packets with frame-level and specific-packet // NACKs, but includes this information only in the next-built RTCP packet. TEST_F(CompoundRtcpBuilderTest, WithNacks) { … } // Tests that the builder produces packets with frame-level ACKs, but includes // this information only in the next-built RTCP packet. Both a single-frame ACK // and a multi-frame ACK are tested, to exercise the various code paths // containing the serialization logic that auto-extends the ACK bit vector // length when necessary. TEST_F(CompoundRtcpBuilderTest, WithAcks) { … } // Tests that the builder handles scenarios where the provided buffer isn't big // enough to hold all the ACK/NACK details. The expected behavior is that it // will include as many of the NACKs as possible, followed by as many of the // ACKs as possible. TEST_F(CompoundRtcpBuilderTest, WithEverythingThatCanFit) { … } } // namespace } // namespace openscreen::cast