mock_packet_buffer.h (2143B)
1 /* 2 * Copyright (c) 2012 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 #ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ 12 #define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ 13 14 #include <cstddef> 15 #include <cstdint> 16 #include <optional> 17 18 #include "modules/audio_coding/neteq/packet.h" 19 #include "modules/audio_coding/neteq/packet_buffer.h" 20 #include "test/gmock.h" 21 22 namespace webrtc { 23 24 class MockPacketBuffer : public PacketBuffer { 25 public: 26 MockPacketBuffer(size_t max_number_of_packets, 27 const TickTimer* tick_timer, 28 StatisticsCalculator* stats) 29 : PacketBuffer(max_number_of_packets, tick_timer, stats) {} 30 ~MockPacketBuffer() override { Die(); } 31 MOCK_METHOD(void, Die, ()); 32 MOCK_METHOD(void, Flush, (), (override)); 33 MOCK_METHOD(bool, Empty, (), (const, override)); 34 MOCK_METHOD(int, InsertPacket, (Packet && packet), (override)); 35 MOCK_METHOD(int, 36 NextTimestamp, 37 (uint32_t * next_timestamp), 38 (const, override)); 39 MOCK_METHOD(int, 40 NextHigherTimestamp, 41 (uint32_t timestamp, uint32_t* next_timestamp), 42 (const, override)); 43 MOCK_METHOD(const Packet*, PeekNextPacket, (), (const, override)); 44 MOCK_METHOD(std::optional<Packet>, GetNextPacket, (), (override)); 45 MOCK_METHOD(int, DiscardNextPacket, (), (override)); 46 MOCK_METHOD(void, 47 DiscardOldPackets, 48 (uint32_t timestamp_limit, uint32_t horizon_samples), 49 (override)); 50 MOCK_METHOD(void, 51 DiscardAllOldPackets, 52 (uint32_t timestamp_limit), 53 (override)); 54 MOCK_METHOD(size_t, NumPacketsInBuffer, (), (const, override)); 55 }; 56 57 } // namespace webrtc 58 #endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_