xref: /aosp_15_r20/external/webrtc/api/test/mock_packet_socket_factory.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 <memory>
15 #include <string>
16 
17 #include "api/packet_socket_factory.h"
18 #include "test/gmock.h"
19 
20 namespace rtc {
21 class MockPacketSocketFactory : public PacketSocketFactory {
22  public:
23   MOCK_METHOD(AsyncPacketSocket*,
24               CreateUdpSocket,
25               (const SocketAddress&, uint16_t, uint16_t),
26               (override));
27   MOCK_METHOD(AsyncListenSocket*,
28               CreateServerTcpSocket,
29               (const SocketAddress&, uint16_t, uint16_t, int opts),
30               (override));
31   MOCK_METHOD(AsyncPacketSocket*,
32               CreateClientTcpSocket,
33               (const SocketAddress& local_address,
34                const SocketAddress&,
35                const ProxyInfo&,
36                const std::string&,
37                const PacketSocketTcpOptions&),
38               (override));
39   MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
40               CreateAsyncDnsResolver,
41               (),
42               (override));
43 };
44 
45 static_assert(!std::is_abstract_v<MockPacketSocketFactory>, "");
46 
47 }  // namespace rtc
48 
49 #endif  // API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_
50