webrtc/api/test/mock_packet_socket_factory.h
Niels Möller 573b145ab5 Reland "Move injection of PacketSocketFactory from PC to PCF"
This is a reland of commit 905c3a6c73

Change from previous attempt is between ps#1 and ps#2: Use PeerConnectionFactoryInterface::Options to clear the `network_ignore_mask`.

Original change's description:
> Move injection of PacketSocketFactory from PC to PCF
>
> Injection via PeerConnectionDependecies was broken, in not accepting
> ownership of the injected object.
>
> Bug: webrtc:7447, webrtc:14204
> Change-Id: Ic53f05d51928b006fc1e46d502633d88471eb518
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266140
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#37270}

Bug: webrtc:7447, webrtc:14204
Change-Id: Ic78ebec2e88a8c44699015c8c7a44e137f44253a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265982
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37290}
2022-06-21 10:28:39 +00:00

49 lines
1.6 KiB
C++

/*
* Copyright (c) 2022 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 API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_
#define API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_
#include <memory>
#include <string>
#include "api/packet_socket_factory.h"
#include "test/gmock.h"
namespace rtc {
class MockPacketSocketFactory : public PacketSocketFactory {
public:
MOCK_METHOD(AsyncPacketSocket*,
CreateUdpSocket,
(const SocketAddress&, uint16_t, uint16_t),
(override));
MOCK_METHOD(AsyncListenSocket*,
CreateServerTcpSocket,
(const SocketAddress&, uint16_t, uint16_t, int opts),
(override));
MOCK_METHOD(AsyncPacketSocket*,
CreateClientTcpSocket,
(const SocketAddress& local_address,
const SocketAddress&,
const ProxyInfo&,
const std::string&,
const PacketSocketTcpOptions&),
(override));
MOCK_METHOD(std::unique_ptr<webrtc::AsyncDnsResolverInterface>,
CreateAsyncDnsResolver,
(),
(override));
};
static_assert(!std::is_abstract_v<MockPacketSocketFactory>, "");
} // namespace rtc
#endif // API_TEST_MOCK_PACKET_SOCKET_FACTORY_H_