OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Common utilities for Quic tests | 5 // Common utilities for Quic tests |
6 | 6 |
7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 }; | 432 }; |
433 | 433 |
434 class MockQuicSpdySession : public QuicSpdySession { | 434 class MockQuicSpdySession : public QuicSpdySession { |
435 public: | 435 public: |
436 explicit MockQuicSpdySession(QuicConnection* connection); | 436 explicit MockQuicSpdySession(QuicConnection* connection); |
437 ~MockQuicSpdySession() override; | 437 ~MockQuicSpdySession() override; |
438 | 438 |
439 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } | 439 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } |
440 | 440 |
441 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 441 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
442 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id)); | 442 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
443 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*()); | 443 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicSpdyStream*()); |
444 MOCK_METHOD6(WritevData, | 444 MOCK_METHOD6(WritevData, |
445 QuicConsumedData(QuicStreamId id, | 445 QuicConsumedData(QuicStreamId id, |
446 const QuicIOVector& data, | 446 const QuicIOVector& data, |
447 QuicStreamOffset offset, | 447 QuicStreamOffset offset, |
448 bool fin, | 448 bool fin, |
449 FecProtection fec_protection, | 449 FecProtection fec_protection, |
450 QuicAckListenerInterface*)); | 450 QuicAckListenerInterface*)); |
451 MOCK_METHOD2(OnStreamHeaders, void(QuicStreamId stream_id, | 451 MOCK_METHOD2(OnStreamHeaders, void(QuicStreamId stream_id, |
452 base::StringPiece headers_data)); | 452 base::StringPiece headers_data)); |
453 MOCK_METHOD2(OnStreamHeadersPriority, void(QuicStreamId stream_id, | 453 MOCK_METHOD2(OnStreamHeadersPriority, void(QuicStreamId stream_id, |
(...skipping 14 matching lines...) Expand all Loading... |
468 DISALLOW_COPY_AND_ASSIGN(MockQuicSpdySession); | 468 DISALLOW_COPY_AND_ASSIGN(MockQuicSpdySession); |
469 }; | 469 }; |
470 | 470 |
471 class TestQuicSpdyServerSession : public QuicSpdySession { | 471 class TestQuicSpdyServerSession : public QuicSpdySession { |
472 public: | 472 public: |
473 TestQuicSpdyServerSession(QuicConnection* connection, | 473 TestQuicSpdyServerSession(QuicConnection* connection, |
474 const QuicConfig& config, | 474 const QuicConfig& config, |
475 const QuicCryptoServerConfig* crypto_config); | 475 const QuicCryptoServerConfig* crypto_config); |
476 ~TestQuicSpdyServerSession() override; | 476 ~TestQuicSpdyServerSession() override; |
477 | 477 |
478 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id)); | 478 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
479 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*()); | 479 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicSpdyStream*()); |
480 | 480 |
481 QuicCryptoServerStream* GetCryptoStream() override; | 481 QuicCryptoServerStream* GetCryptoStream() override; |
482 | 482 |
483 private: | 483 private: |
484 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 484 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
485 | 485 |
486 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyServerSession); | 486 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyServerSession); |
487 }; | 487 }; |
488 | 488 |
489 class TestQuicSpdyClientSession : public QuicClientSessionBase { | 489 class TestQuicSpdyClientSession : public QuicClientSessionBase { |
490 public: | 490 public: |
491 TestQuicSpdyClientSession(QuicConnection* connection, | 491 TestQuicSpdyClientSession(QuicConnection* connection, |
492 const QuicConfig& config, | 492 const QuicConfig& config, |
493 const QuicServerId& server_id, | 493 const QuicServerId& server_id, |
494 QuicCryptoClientConfig* crypto_config); | 494 QuicCryptoClientConfig* crypto_config); |
495 ~TestQuicSpdyClientSession() override; | 495 ~TestQuicSpdyClientSession() override; |
496 | 496 |
497 // QuicClientSessionBase | 497 // QuicClientSessionBase |
498 MOCK_METHOD1(OnProofValid, | 498 MOCK_METHOD1(OnProofValid, |
499 void(const QuicCryptoClientConfig::CachedState& cached)); | 499 void(const QuicCryptoClientConfig::CachedState& cached)); |
500 MOCK_METHOD1(OnProofVerifyDetailsAvailable, | 500 MOCK_METHOD1(OnProofVerifyDetailsAvailable, |
501 void(const ProofVerifyDetails& verify_details)); | 501 void(const ProofVerifyDetails& verify_details)); |
502 | 502 |
503 // TestQuicSpdyClientSession | 503 // TestQuicSpdyClientSession |
504 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id)); | 504 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
505 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*()); | 505 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicSpdyStream*()); |
506 | 506 |
507 QuicCryptoClientStream* GetCryptoStream() override; | 507 QuicCryptoClientStream* GetCryptoStream() override; |
508 | 508 |
509 private: | 509 private: |
510 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 510 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
511 | 511 |
512 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyClientSession); | 512 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyClientSession); |
513 }; | 513 }; |
514 | 514 |
515 class MockPacketWriter : public QuicPacketWriter { | 515 class MockPacketWriter : public QuicPacketWriter { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 TestQuicSpdyServerSession** server_session); | 783 TestQuicSpdyServerSession** server_session); |
784 | 784 |
785 // Helper to generate client side stream ids, generalizes | 785 // Helper to generate client side stream ids, generalizes |
786 // kClientDataStreamId1 etc. above. | 786 // kClientDataStreamId1 etc. above. |
787 QuicStreamId QuicClientDataStreamId(int i); | 787 QuicStreamId QuicClientDataStreamId(int i); |
788 | 788 |
789 } // namespace test | 789 } // namespace test |
790 } // namespace net | 790 } // namespace net |
791 | 791 |
792 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 792 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |