| Index: net/quic/test_tools/quic_test_utils.h
|
| diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
|
| index 83a800ec187bbc8ba566d959368b3b04e6b80d9c..1ef96b692deca828a5fd38680d2bae289ff53eb3 100644
|
| --- a/net/quic/test_tools/quic_test_utils.h
|
| +++ b/net/quic/test_tools/quic_test_utils.h
|
| @@ -10,6 +10,8 @@
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| +#include <cstdint>
|
| +#include <memory>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -318,12 +320,23 @@ class MockConnectionHelper : public QuicConnectionHelperInterface {
|
| ~MockConnectionHelper() override;
|
| const QuicClock* GetClock() const override;
|
| QuicRandom* GetRandomGenerator() override;
|
| + QuicBufferAllocator* GetBufferAllocator() override;
|
| + void AdvanceTime(QuicTime::Delta delta);
|
| +
|
| + private:
|
| + MockClock clock_;
|
| + MockRandom random_generator_;
|
| + SimpleBufferAllocator buffer_allocator_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper);
|
| +};
|
| +
|
| +class MockAlarmFactory : public QuicAlarmFactory {
|
| + public:
|
| QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override;
|
| QuicArenaScopedPtr<QuicAlarm> CreateAlarm(
|
| QuicArenaScopedPtr<QuicAlarm::Delegate> delegate,
|
| QuicConnectionArena* arena) override;
|
| - QuicBufferAllocator* GetBufferAllocator() override;
|
| - void AdvanceTime(QuicTime::Delta delta);
|
|
|
| // No-op alarm implementation
|
| class TestAlarm : public QuicAlarm {
|
| @@ -340,38 +353,37 @@ class MockConnectionHelper : public QuicConnectionHelperInterface {
|
| void FireAlarm(QuicAlarm* alarm) {
|
| reinterpret_cast<TestAlarm*>(alarm)->Fire();
|
| }
|
| -
|
| - private:
|
| - MockClock clock_;
|
| - MockRandom random_generator_;
|
| - SimpleBufferAllocator buffer_allocator_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper);
|
| };
|
|
|
| class MockConnection : public QuicConnection {
|
| public:
|
| // Uses a ConnectionId of 42 and 127.0.0.1:123.
|
| - MockConnection(MockConnectionHelper* helper, Perspective perspective);
|
| + MockConnection(MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| + Perspective perspective);
|
|
|
| // Uses a ConnectionId of 42.
|
| MockConnection(IPEndPoint address,
|
| MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| Perspective perspective);
|
|
|
| // Uses 127.0.0.1:123.
|
| MockConnection(QuicConnectionId connection_id,
|
| MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| Perspective perspective);
|
|
|
| // Uses a ConnectionId of 42, and 127.0.0.1:123.
|
| MockConnection(MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| Perspective perspective,
|
| const QuicVersionVector& supported_versions);
|
|
|
| MockConnection(QuicConnectionId connection_id,
|
| IPEndPoint address,
|
| MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| Perspective perspective,
|
| const QuicVersionVector& supported_versions);
|
|
|
| @@ -435,9 +447,12 @@ class MockConnection : public QuicConnection {
|
|
|
| class PacketSavingConnection : public MockConnection {
|
| public:
|
| - PacketSavingConnection(MockConnectionHelper* helper, Perspective perspective);
|
| + PacketSavingConnection(MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| + Perspective perspective);
|
|
|
| PacketSavingConnection(MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| Perspective perspective,
|
| const QuicVersionVector& supported_versions);
|
|
|
| @@ -486,13 +501,23 @@ class MockQuicSpdySession : public QuicSpdySession {
|
| void(QuicStreamId stream_id, SpdyPriority priority));
|
| MOCK_METHOD3(OnStreamHeadersComplete,
|
| void(QuicStreamId stream_id, bool fin, size_t frame_len));
|
| + MOCK_METHOD4(OnStreamHeaderList,
|
| + void(QuicStreamId stream_id,
|
| + bool fin,
|
| + size_t frame_len,
|
| + const QuicHeaderList& header_list));
|
| + MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool());
|
| MOCK_METHOD2(OnPromiseHeaders,
|
| void(QuicStreamId stream_id, StringPiece headers_data));
|
| MOCK_METHOD3(OnPromiseHeadersComplete,
|
| void(QuicStreamId stream_id,
|
| QuicStreamId promised_stream_id,
|
| size_t frame_len));
|
| - MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool());
|
| + MOCK_METHOD4(OnPromiseHeaderList,
|
| + void(QuicStreamId stream_id,
|
| + QuicStreamId promised_stream_id,
|
| + size_t frame_len,
|
| + const QuicHeaderList& header_list));
|
| MOCK_METHOD5(WriteHeaders,
|
| size_t(QuicStreamId id,
|
| const SpdyHeaderBlock& headers,
|
| @@ -791,6 +816,7 @@ void CreateClientSessionForTest(QuicServerId server_id,
|
| QuicTime::Delta connection_start_time,
|
| QuicVersionVector supported_versions,
|
| MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| QuicCryptoClientConfig* crypto_client_config,
|
| PacketSavingConnection** client_connection,
|
| TestQuicSpdyClientSession** client_session);
|
| @@ -815,6 +841,7 @@ void CreateServerSessionForTest(
|
| QuicTime::Delta connection_start_time,
|
| QuicVersionVector supported_versions,
|
| MockConnectionHelper* helper,
|
| + MockAlarmFactory* alarm_factory,
|
| QuicCryptoServerConfig* crypto_server_config,
|
| QuicCompressedCertsCache* compressed_certs_cache,
|
| PacketSavingConnection** server_connection,
|
|
|