xref: /aosp_15_r20/external/webrtc/net/dcsctp/tx/mock_send_queue.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2021 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 #ifndef NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_
11 #define NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_
12 
13 #include <cstdint>
14 #include <vector>
15 
16 #include "absl/types/optional.h"
17 #include "api/array_view.h"
18 #include "net/dcsctp/tx/send_queue.h"
19 #include "test/gmock.h"
20 
21 namespace dcsctp {
22 
23 class MockSendQueue : public SendQueue {
24  public:
MockSendQueue()25   MockSendQueue() {
26     ON_CALL(*this, Produce).WillByDefault([](TimeMs now, size_t max_size) {
27       return absl::nullopt;
28     });
29   }
30 
31   MOCK_METHOD(absl::optional<SendQueue::DataToSend>,
32               Produce,
33               (TimeMs now, size_t max_size),
34               (override));
35   MOCK_METHOD(bool,
36               Discard,
37               (IsUnordered unordered, StreamID stream_id, MID message_id),
38               (override));
39   MOCK_METHOD(void, PrepareResetStream, (StreamID stream_id), (override));
40   MOCK_METHOD(bool, HasStreamsReadyToBeReset, (), (const, override));
41   MOCK_METHOD(std::vector<StreamID>, GetStreamsReadyToBeReset, (), (override));
42   MOCK_METHOD(void, CommitResetStreams, (), (override));
43   MOCK_METHOD(void, RollbackResetStreams, (), (override));
44   MOCK_METHOD(void, Reset, (), (override));
45   MOCK_METHOD(size_t, buffered_amount, (StreamID stream_id), (const, override));
46   MOCK_METHOD(size_t, total_buffered_amount, (), (const, override));
47   MOCK_METHOD(size_t,
48               buffered_amount_low_threshold,
49               (StreamID stream_id),
50               (const, override));
51   MOCK_METHOD(void,
52               SetBufferedAmountLowThreshold,
53               (StreamID stream_id, size_t bytes),
54               (override));
55   MOCK_METHOD(void, EnableMessageInterleaving, (bool enabled), (override));
56 };
57 
58 }  // namespace dcsctp
59 
60 #endif  // NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_
61