tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rtcp_packet_unittest.cc (1394B)


      1 /*
      2 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include "modules/rtp_rtcp/source/rtcp_packet.h"
     12 
     13 #include <cstddef>
     14 #include <cstdint>
     15 
     16 #include "api/array_view.h"
     17 #include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
     18 #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
     19 #include "test/gmock.h"
     20 #include "test/gtest.h"
     21 
     22 namespace {
     23 
     24 using ::testing::_;
     25 using ::testing::MockFunction;
     26 using ::webrtc::rtcp::ReceiverReport;
     27 using ::webrtc::rtcp::ReportBlock;
     28 
     29 constexpr uint32_t kSenderSsrc = 0x12345678;
     30 
     31 TEST(RtcpPacketTest, BuildWithTooSmallBuffer) {
     32  ReportBlock rb;
     33  ReceiverReport rr;
     34  rr.SetSenderSsrc(kSenderSsrc);
     35  EXPECT_TRUE(rr.AddReportBlock(rb));
     36 
     37  const size_t kRrLength = 8;
     38  const size_t kReportBlockLength = 24;
     39 
     40  // No packet.
     41  MockFunction<void(webrtc::ArrayView<const uint8_t>)> callback;
     42  EXPECT_CALL(callback, Call(_)).Times(0);
     43  const size_t kBufferSize = kRrLength + kReportBlockLength - 1;
     44  EXPECT_FALSE(rr.Build(kBufferSize, callback.AsStdFunction()));
     45 }
     46 
     47 }  // namespace