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 WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
13 
14 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
15 
16 #include "testing/gmock/include/gmock/gmock.h"
17 
18 namespace webrtc {
19 
20 class MockPacketBuffer : public PacketBuffer {
21  public:
MockPacketBuffer(size_t max_number_of_packets)22   MockPacketBuffer(size_t max_number_of_packets)
23       : PacketBuffer(max_number_of_packets) {}
~MockPacketBuffer()24   virtual ~MockPacketBuffer() { Die(); }
25   MOCK_METHOD0(Die, void());
26   MOCK_METHOD0(Flush,
27       void());
28   MOCK_CONST_METHOD0(Empty,
29       bool());
30   MOCK_METHOD1(InsertPacket,
31       int(Packet* packet));
32   MOCK_METHOD4(InsertPacketList,
33       int(PacketList* packet_list,
34           const DecoderDatabase& decoder_database,
35           uint8_t* current_rtp_payload_type,
36           uint8_t* current_cng_rtp_payload_type));
37   MOCK_CONST_METHOD1(NextTimestamp,
38       int(uint32_t* next_timestamp));
39   MOCK_CONST_METHOD2(NextHigherTimestamp,
40       int(uint32_t timestamp, uint32_t* next_timestamp));
41   MOCK_CONST_METHOD0(NextRtpHeader,
42       const RTPHeader*());
43   MOCK_METHOD1(GetNextPacket,
44       Packet*(size_t* discard_count));
45   MOCK_METHOD0(DiscardNextPacket,
46       int());
47   MOCK_METHOD2(DiscardOldPackets,
48       int(uint32_t timestamp_limit, uint32_t horizon_samples));
49   MOCK_METHOD1(DiscardAllOldPackets,
50       int(uint32_t timestamp_limit));
51   MOCK_CONST_METHOD0(NumPacketsInBuffer,
52       size_t());
53   MOCK_METHOD1(IncrementWaitingTimes,
54       void(int));
55   MOCK_CONST_METHOD0(current_memory_bytes,
56       int());
57 };
58 
59 }  // namespace webrtc
60 #endif  // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
61