aboutsummaryrefslogtreecommitdiff
path: root/net/dcsctp/tx/mock_send_queue.h
blob: 0cf64583ae88fe7ef5ef90ffc2982d9172d4eae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *  Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
#ifndef NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_
#define NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_

#include <cstdint>

#include "absl/types/optional.h"
#include "api/array_view.h"
#include "net/dcsctp/tx/send_queue.h"
#include "test/gmock.h"

namespace dcsctp {

class MockSendQueue : public SendQueue {
 public:
  MockSendQueue() {
    ON_CALL(*this, Produce).WillByDefault([](TimeMs now, size_t max_size) {
      return absl::nullopt;
    });
  }

  MOCK_METHOD(absl::optional<SendQueue::DataToSend>,
              Produce,
              (TimeMs now, size_t max_size),
              (override));
  MOCK_METHOD(bool,
              Discard,
              (IsUnordered unordered, StreamID stream_id, MID message_id),
              (override));
  MOCK_METHOD(void,
              PrepareResetStreams,
              (rtc::ArrayView<const StreamID> streams),
              (override));
  MOCK_METHOD(bool, CanResetStreams, (), (const, override));
  MOCK_METHOD(void, CommitResetStreams, (), (override));
  MOCK_METHOD(void, RollbackResetStreams, (), (override));
  MOCK_METHOD(void, Reset, (), (override));
  MOCK_METHOD(size_t, buffered_amount, (StreamID stream_id), (const, override));
  MOCK_METHOD(size_t, total_buffered_amount, (), (const, override));
  MOCK_METHOD(size_t,
              buffered_amount_low_threshold,
              (StreamID stream_id),
              (const, override));
  MOCK_METHOD(void,
              SetBufferedAmountLowThreshold,
              (StreamID stream_id, size_t bytes),
              (override));
};

}  // namespace dcsctp

#endif  // NET_DCSCTP_TX_MOCK_SEND_QUEUE_H_