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_PUBLIC_MOCK_DCSCTP_SOCKET_H_ 11 #define NET_DCSCTP_PUBLIC_MOCK_DCSCTP_SOCKET_H_ 12 13 #include "net/dcsctp/public/dcsctp_socket.h" 14 #include "test/gmock.h" 15 16 namespace dcsctp { 17 18 class MockDcSctpSocket : public DcSctpSocketInterface { 19 public: 20 MOCK_METHOD(void, 21 ReceivePacket, 22 (rtc::ArrayView<const uint8_t> data), 23 (override)); 24 25 MOCK_METHOD(void, HandleTimeout, (TimeoutID timeout_id), (override)); 26 27 MOCK_METHOD(void, Connect, (), (override)); 28 29 MOCK_METHOD(void, 30 RestoreFromState, 31 (const DcSctpSocketHandoverState&), 32 (override)); 33 34 MOCK_METHOD(void, Shutdown, (), (override)); 35 36 MOCK_METHOD(void, Close, (), (override)); 37 38 MOCK_METHOD(SocketState, state, (), (const, override)); 39 40 MOCK_METHOD(const DcSctpOptions&, options, (), (const, override)); 41 42 MOCK_METHOD(void, SetMaxMessageSize, (size_t max_message_size), (override)); 43 44 MOCK_METHOD(void, 45 SetStreamPriority, 46 (StreamID stream_id, StreamPriority priority), 47 (override)); 48 49 MOCK_METHOD(StreamPriority, 50 GetStreamPriority, 51 (StreamID stream_id), 52 (const, override)); 53 54 MOCK_METHOD(SendStatus, 55 Send, 56 (DcSctpMessage message, const SendOptions& send_options), 57 (override)); 58 59 MOCK_METHOD(ResetStreamsStatus, 60 ResetStreams, 61 (rtc::ArrayView<const StreamID> outgoing_streams), 62 (override)); 63 64 MOCK_METHOD(size_t, buffered_amount, (StreamID stream_id), (const, override)); 65 66 MOCK_METHOD(size_t, 67 buffered_amount_low_threshold, 68 (StreamID stream_id), 69 (const, override)); 70 71 MOCK_METHOD(void, 72 SetBufferedAmountLowThreshold, 73 (StreamID stream_id, size_t bytes), 74 (override)); 75 76 MOCK_METHOD(absl::optional<Metrics>, GetMetrics, (), (const, override)); 77 78 MOCK_METHOD(HandoverReadinessStatus, 79 GetHandoverReadiness, 80 (), 81 (const, override)); 82 MOCK_METHOD(absl::optional<DcSctpSocketHandoverState>, 83 GetHandoverStateAndClose, 84 (), 85 (override)); 86 }; 87 88 } // namespace dcsctp 89 90 #endif // NET_DCSCTP_PUBLIC_MOCK_DCSCTP_SOCKET_H_ 91