61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
/*
|
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
|
* its licensors.
|
|
*
|
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
|
* distribution (the "License"). All use of this software is governed by the License,
|
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AzNetworking/ConnectionLayer/IConnection.h>
|
|
#include <gmock/gmock.h>
|
|
|
|
// The following is a mock of IConnection used to test endpoints in MultiplayerSystemComponent
|
|
// without an actual IConnection
|
|
|
|
using namespace AzNetworking;
|
|
|
|
class IMultiplayerConnectionMock : public IConnection
|
|
{
|
|
public:
|
|
IMultiplayerConnectionMock(ConnectionId connectionId, const IpAddress& address, ConnectionRole connectionRole)
|
|
: IConnection(connectionId, address)
|
|
, m_role(connectionRole)
|
|
{
|
|
;
|
|
}
|
|
|
|
~IMultiplayerConnectionMock() override{};
|
|
|
|
MOCK_METHOD1(SendReliablePacket, bool(const IPacket&));
|
|
|
|
MOCK_METHOD1(SendUnreliablePacket, PacketId(const IPacket&));
|
|
|
|
MOCK_CONST_METHOD1(WasPacketAcked, bool(const PacketId));
|
|
|
|
MOCK_CONST_METHOD0(GetConnectionState, ConnectionState());
|
|
|
|
ConnectionRole GetConnectionRole() const override
|
|
{
|
|
return m_role;
|
|
};
|
|
|
|
MOCK_METHOD2(Disconnect, bool(DisconnectReason, TerminationEndpoint));
|
|
|
|
MOCK_METHOD1(SetConnectionMtu, void(uint32_t));
|
|
|
|
MOCK_CONST_METHOD0(GetConnectionMtu, uint32_t());
|
|
|
|
MOCK_METHOD1(SetConnectionMtu, void(const ConnectionQuality&));
|
|
|
|
MOCK_METHOD1(SetConnectionQuality, void(const ConnectionQuality&));
|
|
|
|
ConnectionRole m_role;
|
|
};
|
|
|