OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ |
13 | 13 |
14 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h" | 14 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h" |
15 | 15 |
16 #include "webrtc/test/gmock.h" | 16 #include "webrtc/test/gmock.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 class MockPacketBuffer : public PacketBuffer { | 20 class MockPacketBuffer : public PacketBuffer { |
21 public: | 21 public: |
22 MockPacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer) | 22 MockPacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer) |
23 : PacketBuffer(max_number_of_packets, tick_timer) {} | 23 : PacketBuffer(max_number_of_packets, tick_timer) {} |
24 virtual ~MockPacketBuffer() { Die(); } | 24 virtual ~MockPacketBuffer() { Die(); } |
25 MOCK_METHOD0(Die, void()); | 25 MOCK_METHOD0(Die, void()); |
26 MOCK_METHOD0(Flush, | 26 MOCK_METHOD0(Flush, |
27 void()); | 27 void()); |
28 MOCK_CONST_METHOD0(Empty, | 28 MOCK_CONST_METHOD0(Empty, |
29 bool()); | 29 bool()); |
30 MOCK_METHOD1(InsertPacket, | 30 int InsertPacket(Packet&& packet) { |
31 int(Packet* packet)); | 31 return InsertPacketWrapped(packet); |
32 } | |
33 // Since gtest does not properly support move-only types, InsertPacket is | |
34 // implemented as a wrapper. You'll have to implement InsertPacketWrapped | |
35 // instead. | |
36 MOCK_METHOD1(InsertPacketWrapped, | |
37 int(Packet& packet)); | |
kwiberg-webrtc
2016/10/20 22:39:22
It would be more style guide compliant to pass by
ossu
2016/10/21 12:54:41
Done... I miss references :(
| |
32 MOCK_METHOD4(InsertPacketList, | 38 MOCK_METHOD4(InsertPacketList, |
33 int(PacketList* packet_list, | 39 int(PacketList* packet_list, |
34 const DecoderDatabase& decoder_database, | 40 const DecoderDatabase& decoder_database, |
35 rtc::Optional<uint8_t>* current_rtp_payload_type, | 41 rtc::Optional<uint8_t>* current_rtp_payload_type, |
36 rtc::Optional<uint8_t>* current_cng_rtp_payload_type)); | 42 rtc::Optional<uint8_t>* current_cng_rtp_payload_type)); |
37 MOCK_CONST_METHOD1(NextTimestamp, | 43 MOCK_CONST_METHOD1(NextTimestamp, |
38 int(uint32_t* next_timestamp)); | 44 int(uint32_t* next_timestamp)); |
39 MOCK_CONST_METHOD2(NextHigherTimestamp, | 45 MOCK_CONST_METHOD2(NextHigherTimestamp, |
40 int(uint32_t timestamp, uint32_t* next_timestamp)); | 46 int(uint32_t timestamp, uint32_t* next_timestamp)); |
41 MOCK_CONST_METHOD0(PeekNextPacket, | 47 MOCK_CONST_METHOD0(PeekNextPacket, |
42 const Packet*()); | 48 const Packet*()); |
43 MOCK_METHOD1(GetNextPacket, | 49 MOCK_METHOD0(GetNextPacket, |
44 Packet*(size_t* discard_count)); | 50 rtc::Optional<Packet>()); |
45 MOCK_METHOD0(DiscardNextPacket, | 51 MOCK_METHOD0(DiscardNextPacket, |
46 int()); | 52 int()); |
47 MOCK_METHOD2(DiscardOldPackets, | 53 MOCK_METHOD2(DiscardOldPackets, |
48 int(uint32_t timestamp_limit, uint32_t horizon_samples)); | 54 int(uint32_t timestamp_limit, uint32_t horizon_samples)); |
49 MOCK_METHOD1(DiscardAllOldPackets, | 55 MOCK_METHOD1(DiscardAllOldPackets, |
50 int(uint32_t timestamp_limit)); | 56 int(uint32_t timestamp_limit)); |
51 MOCK_CONST_METHOD0(NumPacketsInBuffer, | 57 MOCK_CONST_METHOD0(NumPacketsInBuffer, |
52 size_t()); | 58 size_t()); |
53 MOCK_METHOD1(IncrementWaitingTimes, | 59 MOCK_METHOD1(IncrementWaitingTimes, |
54 void(int)); | 60 void(int)); |
55 MOCK_CONST_METHOD0(current_memory_bytes, | 61 MOCK_CONST_METHOD0(current_memory_bytes, |
56 int()); | 62 int()); |
57 }; | 63 }; |
58 | 64 |
59 } // namespace webrtc | 65 } // namespace webrtc |
60 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ | 66 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ |
OLD | NEW |