diff options
Diffstat (limited to 'net/quic/test_tools/quic_test_utils.h')
-rw-r--r-- | net/quic/test_tools/quic_test_utils.h | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h index acabd7c..e3a75c4 100644 --- a/net/quic/test_tools/quic_test_utils.h +++ b/net/quic/test_tools/quic_test_utils.h @@ -10,8 +10,6 @@ #include "net/quic/congestion_control/quic_send_scheduler.h" #include "net/quic/quic_connection.h" #include "net/quic/quic_framer.h" -#include "net/quic/quic_session.h" -#include "net/quic/test_tools/mock_clock.h" #include "testing/gmock/include/gmock/gmock.h" namespace net { @@ -68,6 +66,7 @@ class NoOpFramerVisitor : public QuicFramerVisitorInterface { virtual void OnPacketComplete() OVERRIDE {} }; + class FramerVisitorCapturingAcks : public NoOpFramerVisitor { public: // NoOpFramerVisitor @@ -84,7 +83,7 @@ class FramerVisitorCapturingAcks : public NoOpFramerVisitor { class MockConnectionVisitor : public QuicConnectionVisitorInterface { public: MockConnectionVisitor(); - virtual ~MockConnectionVisitor(); + ~MockConnectionVisitor(); MOCK_METHOD4(OnPacket, bool(const IPEndPoint& self_address, const IPEndPoint& peer_address, const QuicPacketHeader& header, @@ -104,78 +103,6 @@ class MockScheduler : public QuicSendScheduler { MOCK_METHOD3(SentPacket, void(QuicPacketSequenceNumber, size_t, bool)); }; -class MockHelper : public QuicConnectionHelperInterface { - public: - MockHelper(); - virtual ~MockHelper(); - - MOCK_METHOD1(SetConnection, void(QuicConnection* connection)); - QuicClock* GetClock(); - MOCK_METHOD4(WritePacketToWire, int(QuicPacketSequenceNumber number, - const QuicEncryptedPacket& packet, - bool resend, - int* error)); - MOCK_METHOD2(SetResendAlarm, void(QuicPacketSequenceNumber sequence_number, - uint64 delay_in_us)); - MOCK_METHOD1(SetSendAlarm, void(uint64 delay_in_us)); - MOCK_METHOD1(SetTimeoutAlarm, void(uint64 delay_in_us)); - MOCK_METHOD0(IsSendAlarmSet, bool()); - MOCK_METHOD0(UnregisterSendAlarmIfRegistered, void()); - private: - MockClock clock_; -}; - -class MockConnection : public QuicConnection { - public: - MockConnection(QuicGuid guid, IPEndPoint address); - virtual ~MockConnection(); - - MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, - const IPEndPoint& peer_address, - const QuicEncryptedPacket& packet)); - MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); - - MOCK_METHOD3(SendRstStream, void(QuicStreamId id, - QuicErrorCode error, - QuicStreamOffset offset)); - - MOCK_METHOD0(OnCanWrite, bool()); -}; - -class PacketSavingConnection : public MockConnection { - public: - PacketSavingConnection(QuicGuid guid, IPEndPoint address); - virtual ~PacketSavingConnection(); - - virtual bool SendPacket(QuicPacketSequenceNumber number, - QuicPacket* packet, - bool resend, - bool force) OVERRIDE; - - std::vector<QuicPacket*> packets_; -}; - -class MockSession : public QuicSession { - public: - MockSession(QuicConnection* connection, bool is_server); - ~MockSession(); - - MOCK_METHOD4(OnPacket, bool(const IPEndPoint& seld_address, - const IPEndPoint& peer_address, - const QuicPacketHeader& header, - const std::vector<QuicStreamFrame>& frame)); - MOCK_METHOD2(ConnectionClose, void(QuicErrorCode error, bool from_peer)); - MOCK_METHOD1(CreateIncomingReliableStream, - ReliableQuicStream*(QuicStreamId id)); - MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); - MOCK_METHOD0(CreateOutgoingReliableStream, ReliableQuicStream*()); - MOCK_METHOD3(WriteData, - void(QuicStreamId id, base::StringPiece data, bool fin)); - MOCK_METHOD4(WriteData, int(QuicStreamId id, base::StringPiece data, - QuicStreamOffset offset, bool fin)); - MOCK_METHOD0(IsHandshakeComplete, bool()); -}; - } // namespace test } // namespace net |