• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PLATFORM_TEST_MOCK_UDP_SOCKET_H_
6 #define PLATFORM_TEST_MOCK_UDP_SOCKET_H_
7 
8 #include <algorithm>
9 #include <queue>
10 
11 #include "gmock/gmock.h"
12 #include "platform/api/udp_socket.h"
13 
14 namespace openscreen {
15 
16 class MockUdpSocket : public UdpSocket {
17  public:
18   MockUdpSocket() = default;
19   ~MockUdpSocket() override = default;
20 
21   MOCK_CONST_METHOD0(IsIPv4, bool());
22   MOCK_CONST_METHOD0(IsIPv6, bool());
23   MOCK_CONST_METHOD0(GetLocalEndpoint, IPEndpoint());
24   MOCK_METHOD0(Bind, void());
25   MOCK_METHOD1(SetMulticastOutboundInterface, void(NetworkInterfaceIndex));
26   MOCK_METHOD2(JoinMulticastGroup,
27                void(const IPAddress&, NetworkInterfaceIndex));
28   MOCK_METHOD3(SendMessage, void(const void*, size_t, const IPEndpoint&));
29   MOCK_METHOD1(SetDscp, void(UdpSocket::DscpMode));
30 };
31 
32 }  // namespace openscreen
33 
34 #endif  // PLATFORM_TEST_MOCK_UDP_SOCKET_H_
35