mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
use a GoMock mock session in the server and client tests
This commit is contained in:
parent
511ff00881
commit
15da47cf98
5 changed files with 556 additions and 338 deletions
232
mock_packet_handler_test.go
Normal file
232
mock_packet_handler_test.go
Normal file
|
@ -0,0 +1,232 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/lucas-clemente/quic-go (interfaces: PacketHandler)
|
||||
|
||||
// Package quic is a generated GoMock package.
|
||||
package quic
|
||||
|
||||
import (
|
||||
context "context"
|
||||
net "net"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
handshake "github.com/lucas-clemente/quic-go/internal/handshake"
|
||||
protocol "github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
)
|
||||
|
||||
// MockPacketHandler is a mock of PacketHandler interface
|
||||
type MockPacketHandler struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPacketHandlerMockRecorder
|
||||
}
|
||||
|
||||
// MockPacketHandlerMockRecorder is the mock recorder for MockPacketHandler
|
||||
type MockPacketHandlerMockRecorder struct {
|
||||
mock *MockPacketHandler
|
||||
}
|
||||
|
||||
// NewMockPacketHandler creates a new mock instance
|
||||
func NewMockPacketHandler(ctrl *gomock.Controller) *MockPacketHandler {
|
||||
mock := &MockPacketHandler{ctrl: ctrl}
|
||||
mock.recorder = &MockPacketHandlerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use
|
||||
func (m *MockPacketHandler) EXPECT() *MockPacketHandlerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// AcceptStream mocks base method
|
||||
func (m *MockPacketHandler) AcceptStream() (Stream, error) {
|
||||
ret := m.ctrl.Call(m, "AcceptStream")
|
||||
ret0, _ := ret[0].(Stream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// AcceptStream indicates an expected call of AcceptStream
|
||||
func (mr *MockPacketHandlerMockRecorder) AcceptStream() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptStream", reflect.TypeOf((*MockPacketHandler)(nil).AcceptStream))
|
||||
}
|
||||
|
||||
// AcceptUniStream mocks base method
|
||||
func (m *MockPacketHandler) AcceptUniStream() (ReceiveStream, error) {
|
||||
ret := m.ctrl.Call(m, "AcceptUniStream")
|
||||
ret0, _ := ret[0].(ReceiveStream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// AcceptUniStream indicates an expected call of AcceptUniStream
|
||||
func (mr *MockPacketHandlerMockRecorder) AcceptUniStream() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptUniStream", reflect.TypeOf((*MockPacketHandler)(nil).AcceptUniStream))
|
||||
}
|
||||
|
||||
// Close mocks base method
|
||||
func (m *MockPacketHandler) Close(arg0 error) error {
|
||||
ret := m.ctrl.Call(m, "Close", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Close indicates an expected call of Close
|
||||
func (mr *MockPacketHandlerMockRecorder) Close(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPacketHandler)(nil).Close), arg0)
|
||||
}
|
||||
|
||||
// ConnectionState mocks base method
|
||||
func (m *MockPacketHandler) ConnectionState() handshake.ConnectionState {
|
||||
ret := m.ctrl.Call(m, "ConnectionState")
|
||||
ret0, _ := ret[0].(handshake.ConnectionState)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConnectionState indicates an expected call of ConnectionState
|
||||
func (mr *MockPacketHandlerMockRecorder) ConnectionState() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionState", reflect.TypeOf((*MockPacketHandler)(nil).ConnectionState))
|
||||
}
|
||||
|
||||
// Context mocks base method
|
||||
func (m *MockPacketHandler) Context() context.Context {
|
||||
ret := m.ctrl.Call(m, "Context")
|
||||
ret0, _ := ret[0].(context.Context)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Context indicates an expected call of Context
|
||||
func (mr *MockPacketHandlerMockRecorder) Context() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockPacketHandler)(nil).Context))
|
||||
}
|
||||
|
||||
// GetVersion mocks base method
|
||||
func (m *MockPacketHandler) GetVersion() protocol.VersionNumber {
|
||||
ret := m.ctrl.Call(m, "GetVersion")
|
||||
ret0, _ := ret[0].(protocol.VersionNumber)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetVersion indicates an expected call of GetVersion
|
||||
func (mr *MockPacketHandlerMockRecorder) GetVersion() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVersion", reflect.TypeOf((*MockPacketHandler)(nil).GetVersion))
|
||||
}
|
||||
|
||||
// LocalAddr mocks base method
|
||||
func (m *MockPacketHandler) LocalAddr() net.Addr {
|
||||
ret := m.ctrl.Call(m, "LocalAddr")
|
||||
ret0, _ := ret[0].(net.Addr)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// LocalAddr indicates an expected call of LocalAddr
|
||||
func (mr *MockPacketHandlerMockRecorder) LocalAddr() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalAddr", reflect.TypeOf((*MockPacketHandler)(nil).LocalAddr))
|
||||
}
|
||||
|
||||
// OpenStream mocks base method
|
||||
func (m *MockPacketHandler) OpenStream() (Stream, error) {
|
||||
ret := m.ctrl.Call(m, "OpenStream")
|
||||
ret0, _ := ret[0].(Stream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// OpenStream indicates an expected call of OpenStream
|
||||
func (mr *MockPacketHandlerMockRecorder) OpenStream() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStream", reflect.TypeOf((*MockPacketHandler)(nil).OpenStream))
|
||||
}
|
||||
|
||||
// OpenStreamSync mocks base method
|
||||
func (m *MockPacketHandler) OpenStreamSync() (Stream, error) {
|
||||
ret := m.ctrl.Call(m, "OpenStreamSync")
|
||||
ret0, _ := ret[0].(Stream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// OpenStreamSync indicates an expected call of OpenStreamSync
|
||||
func (mr *MockPacketHandlerMockRecorder) OpenStreamSync() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStreamSync", reflect.TypeOf((*MockPacketHandler)(nil).OpenStreamSync))
|
||||
}
|
||||
|
||||
// OpenUniStream mocks base method
|
||||
func (m *MockPacketHandler) OpenUniStream() (SendStream, error) {
|
||||
ret := m.ctrl.Call(m, "OpenUniStream")
|
||||
ret0, _ := ret[0].(SendStream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// OpenUniStream indicates an expected call of OpenUniStream
|
||||
func (mr *MockPacketHandlerMockRecorder) OpenUniStream() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStream", reflect.TypeOf((*MockPacketHandler)(nil).OpenUniStream))
|
||||
}
|
||||
|
||||
// OpenUniStreamSync mocks base method
|
||||
func (m *MockPacketHandler) OpenUniStreamSync() (SendStream, error) {
|
||||
ret := m.ctrl.Call(m, "OpenUniStreamSync")
|
||||
ret0, _ := ret[0].(SendStream)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// OpenUniStreamSync indicates an expected call of OpenUniStreamSync
|
||||
func (mr *MockPacketHandlerMockRecorder) OpenUniStreamSync() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStreamSync", reflect.TypeOf((*MockPacketHandler)(nil).OpenUniStreamSync))
|
||||
}
|
||||
|
||||
// RemoteAddr mocks base method
|
||||
func (m *MockPacketHandler) RemoteAddr() net.Addr {
|
||||
ret := m.ctrl.Call(m, "RemoteAddr")
|
||||
ret0, _ := ret[0].(net.Addr)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// RemoteAddr indicates an expected call of RemoteAddr
|
||||
func (mr *MockPacketHandlerMockRecorder) RemoteAddr() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockPacketHandler)(nil).RemoteAddr))
|
||||
}
|
||||
|
||||
// closeRemote mocks base method
|
||||
func (m *MockPacketHandler) closeRemote(arg0 error) {
|
||||
m.ctrl.Call(m, "closeRemote", arg0)
|
||||
}
|
||||
|
||||
// closeRemote indicates an expected call of closeRemote
|
||||
func (mr *MockPacketHandlerMockRecorder) closeRemote(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "closeRemote", reflect.TypeOf((*MockPacketHandler)(nil).closeRemote), arg0)
|
||||
}
|
||||
|
||||
// getCryptoStream mocks base method
|
||||
func (m *MockPacketHandler) getCryptoStream() cryptoStreamI {
|
||||
ret := m.ctrl.Call(m, "getCryptoStream")
|
||||
ret0, _ := ret[0].(cryptoStreamI)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// getCryptoStream indicates an expected call of getCryptoStream
|
||||
func (mr *MockPacketHandlerMockRecorder) getCryptoStream() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getCryptoStream", reflect.TypeOf((*MockPacketHandler)(nil).getCryptoStream))
|
||||
}
|
||||
|
||||
// handlePacket mocks base method
|
||||
func (m *MockPacketHandler) handlePacket(arg0 *receivedPacket) {
|
||||
m.ctrl.Call(m, "handlePacket", arg0)
|
||||
}
|
||||
|
||||
// handlePacket indicates an expected call of handlePacket
|
||||
func (mr *MockPacketHandlerMockRecorder) handlePacket(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handlePacket", reflect.TypeOf((*MockPacketHandler)(nil).handlePacket), arg0)
|
||||
}
|
||||
|
||||
// run mocks base method
|
||||
func (m *MockPacketHandler) run() error {
|
||||
ret := m.ctrl.Call(m, "run")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// run indicates an expected call of run
|
||||
func (mr *MockPacketHandlerMockRecorder) run() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "run", reflect.TypeOf((*MockPacketHandler)(nil).run))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue