mock_packet_socket_factory.h (1821B)
1 /* 2 * Copyright (c) 2022 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 API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_ 12 #define API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_ 13 14 #include <cstdint> 15 #include <memory> 16 #include <type_traits> 17 18 #include "api/async_dns_resolver.h" 19 #include "api/environment/environment.h" 20 #include "api/packet_socket_factory.h" 21 #include "rtc_base/async_packet_socket.h" 22 #include "rtc_base/socket_address.h" 23 #include "test/gmock.h" 24 25 namespace webrtc { 26 class MockPacketSocketFactory : public PacketSocketFactory { 27 public: 28 MOCK_METHOD(std::unique_ptr<AsyncPacketSocket>, 29 CreateUdpSocket, 30 (const Environment&, const SocketAddress&, uint16_t, uint16_t), 31 (override)); 32 MOCK_METHOD( 33 std::unique_ptr<AsyncListenSocket>, 34 CreateServerTcpSocket, 35 (const Environment&, const SocketAddress&, uint16_t, uint16_t, int opts), 36 (override)); 37 MOCK_METHOD(std::unique_ptr<AsyncPacketSocket>, 38 CreateClientTcpSocket, 39 (const Environment&, 40 const SocketAddress& local_address, 41 const SocketAddress&, 42 const PacketSocketTcpOptions&), 43 (override)); 44 MOCK_METHOD(std::unique_ptr<AsyncDnsResolverInterface>, 45 CreateAsyncDnsResolver, 46 (), 47 (override)); 48 }; 49 50 static_assert(!std::is_abstract_v<MockPacketSocketFactory>, ""); 51 52 } // namespace webrtc 53 54 55 #endif // API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_