Mock CPM everywhere using gomock

This commit is contained in:
Lucas Clemente 2017-06-09 12:38:07 +02:00
parent d01f9880be
commit c02f904479
4 changed files with 23 additions and 53 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/lucas-clemente/quic-go/ackhandler"
"github.com/lucas-clemente/quic-go/frames"
"github.com/lucas-clemente/quic-go/handshake"
"github.com/lucas-clemente/quic-go/internal/mocks"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/lucas-clemente/quic-go/qerr"
. "github.com/onsi/ginkgo"
@ -48,12 +49,14 @@ var _ = Describe("Packet packer", func() {
)
BeforeEach(func() {
cpm := &mockConnectionParametersManager{}
streamFramer = newStreamFramer(newStreamsMap(nil, protocol.PerspectiveServer, cpm), nil)
mockCpm := mocks.NewMockConnectionParametersManager(mockCtrl)
mockCpm.EXPECT().TruncateConnectionID().Return(false).AnyTimes()
streamFramer = newStreamFramer(newStreamsMap(nil, protocol.PerspectiveServer, nil), nil)
packer = &packetPacker{
cryptoSetup: &mockCryptoSetup{encLevelSeal: protocol.EncryptionForwardSecure},
connectionParameters: cpm,
connectionParameters: mockCpm,
connectionID: 0x1337,
packetNumberGenerator: newPacketNumberGenerator(protocol.SkipPacketAveragePeriodLength),
streamFramer: streamFramer,