// 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/rtcp_common.h" #include <chrono> #include <limits> #include "gtest/gtest.h" #include "platform/api/time.h" #include "platform/base/span.h" #include "util/chrono_helpers.h" namespace openscreen::cast { namespace { template <typename T> void SerializeAndExpectPointerAdvanced(const T& source, int num_bytes, uint8_t* buffer) { … } // Tests that the RTCP Common Header for a packet type that includes an Item // Count is successfully serialized and re-parsed. TEST(RtcpCommonTest, SerializesAndParsesHeaderForSenderReports) { … } // Tests that the RTCP Common Header for a packet type that includes a RTCP // Subtype is successfully serialized and re-parsed. TEST(RtcpCommonTest, SerializesAndParsesHeaderForCastFeedback) { … } // Tests that a RTCP Common Header will not be parsed from an empty buffer. TEST(RtcpCommonTest, WillNotParseHeaderFromEmptyBuffer) { … } // Tests that a RTCP Common Header will not be parsed from a buffer containing // garbage data. TEST(RtcpCommonTest, WillNotParseHeaderFromGarbage) { … } // Tests whether RTCP Common Header validation logic is correct. TEST(RtcpCommonTest, WillNotParseHeaderWithInvalidData) { … } // Test that the Report Block optionally included in Sender Reports or Receiver // Reports can be serialized and re-parsed correctly. TEST(RtcpCommonTest, SerializesAndParsesRtcpReportBlocks) { … } // Tests that the Report Block parser can, among multiple Report Blocks, find // the one with a matching recipient SSRC. TEST(RtcpCommonTest, ParsesOneReportBlockFromMultipleBlocks) { … } // Tests the helper for computing the packet fraction loss numerator, a value // that should always be between 0 and 255, in terms of absolute packet counts. TEST(RtcpCommonTest, ComputesPacketLossFractionForReportBlocks) { … } // Tests the helper for computing the cumulative packet loss total, a value that // should always be between 0 and 2^24 - 1, in terms of absolute packet counts. TEST(RtcpCommonTest, ComputesCumulativePacketLossForReportBlocks) { … } // Tests the helper that converts Clock::durations to the report blocks timebase // (1/65536 sconds), and also that it saturates to to the valid range of values // (0 to 2^32 - 1 ticks). TEST(RtcpCommonTest, ComputesDelayForReportBlocks) { … } } // namespace } // namespace openscreen::cast