| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 MOCK_METHOD3(OnConnectionClosed, | 505 MOCK_METHOD3(OnConnectionClosed, |
| 506 void(QuicErrorCode error, | 506 void(QuicErrorCode error, |
| 507 const std::string& error_details, | 507 const std::string& error_details, |
| 508 ConnectionCloseSource source)); | 508 ConnectionCloseSource source)); |
| 509 MOCK_METHOD1(CreateIncomingDynamicStream, | 509 MOCK_METHOD1(CreateIncomingDynamicStream, |
| 510 ReliableQuicStream*(QuicStreamId id)); | 510 ReliableQuicStream*(QuicStreamId id)); |
| 511 MOCK_METHOD1(CreateOutgoingDynamicStream, | 511 MOCK_METHOD1(CreateOutgoingDynamicStream, |
| 512 ReliableQuicStream*(SpdyPriority priority)); | 512 ReliableQuicStream*(SpdyPriority priority)); |
| 513 MOCK_METHOD1(ShouldCreateIncomingDynamicStream, bool(QuicStreamId id)); | 513 MOCK_METHOD1(ShouldCreateIncomingDynamicStream, bool(QuicStreamId id)); |
| 514 MOCK_METHOD0(ShouldCreateOutgoingDynamicStream, bool()); | 514 MOCK_METHOD0(ShouldCreateOutgoingDynamicStream, bool()); |
| 515 MOCK_METHOD5(WritevData, | 515 MOCK_METHOD6(WritevData, |
| 516 QuicConsumedData(QuicStreamId id, | 516 QuicConsumedData(ReliableQuicStream* stream, |
| 517 QuicStreamId id, |
| 517 QuicIOVector data, | 518 QuicIOVector data, |
| 518 QuicStreamOffset offset, | 519 QuicStreamOffset offset, |
| 519 bool fin, | 520 bool fin, |
| 520 QuicAckListenerInterface*)); | 521 QuicAckListenerInterface*)); |
| 521 | 522 |
| 522 MOCK_METHOD3(SendRstStream, | 523 MOCK_METHOD3(SendRstStream, |
| 523 void(QuicStreamId stream_id, | 524 void(QuicStreamId stream_id, |
| 524 QuicRstStreamErrorCode error, | 525 QuicRstStreamErrorCode error, |
| 525 QuicStreamOffset bytes_written)); | 526 QuicStreamOffset bytes_written)); |
| 526 | 527 |
| 527 MOCK_METHOD2(OnStreamHeaders, | 528 MOCK_METHOD2(OnStreamHeaders, |
| 528 void(QuicStreamId stream_id, base::StringPiece headers_data)); | 529 void(QuicStreamId stream_id, base::StringPiece headers_data)); |
| 529 MOCK_METHOD2(OnStreamHeadersPriority, | 530 MOCK_METHOD2(OnStreamHeadersPriority, |
| 530 void(QuicStreamId stream_id, SpdyPriority priority)); | 531 void(QuicStreamId stream_id, SpdyPriority priority)); |
| 531 MOCK_METHOD3(OnStreamHeadersComplete, | 532 MOCK_METHOD3(OnStreamHeadersComplete, |
| 532 void(QuicStreamId stream_id, bool fin, size_t frame_len)); | 533 void(QuicStreamId stream_id, bool fin, size_t frame_len)); |
| 533 MOCK_METHOD4(OnStreamHeaderList, | |
| 534 void(QuicStreamId stream_id, | |
| 535 bool fin, | |
| 536 size_t frame_len, | |
| 537 const QuicHeaderList& header_list)); | |
| 538 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); | 534 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); |
| 539 | 535 |
| 540 using QuicSession::ActivateStream; | 536 using QuicSession::ActivateStream; |
| 541 | 537 |
| 542 // Returns a QuicConsumedData that indicates all of |data| (and |fin| if set) | 538 // Returns a QuicConsumedData that indicates all of |data| (and |fin| if set) |
| 543 // has been consumed. | 539 // has been consumed. |
| 544 static QuicConsumedData ConsumeAllData( | 540 static QuicConsumedData ConsumeAllData( |
| 541 ReliableQuicStream* stream, |
| 545 QuicStreamId id, | 542 QuicStreamId id, |
| 546 const QuicIOVector& data, | 543 const QuicIOVector& data, |
| 547 QuicStreamOffset offset, | 544 QuicStreamOffset offset, |
| 548 bool fin, | 545 bool fin, |
| 549 QuicAckListenerInterface* ack_notifier_delegate); | 546 QuicAckListenerInterface* ack_notifier_delegate); |
| 550 | 547 |
| 551 private: | 548 private: |
| 552 std::unique_ptr<QuicCryptoStream> crypto_stream_; | 549 std::unique_ptr<QuicCryptoStream> crypto_stream_; |
| 553 | 550 |
| 554 DISALLOW_COPY_AND_ASSIGN(MockQuicSession); | 551 DISALLOW_COPY_AND_ASSIGN(MockQuicSession); |
| 555 }; | 552 }; |
| 556 | 553 |
| 557 class MockQuicSpdySession : public QuicSpdySession { | 554 class MockQuicSpdySession : public QuicSpdySession { |
| 558 public: | 555 public: |
| 559 explicit MockQuicSpdySession(QuicConnection* connection); | 556 explicit MockQuicSpdySession(QuicConnection* connection); |
| 560 ~MockQuicSpdySession() override; | 557 ~MockQuicSpdySession() override; |
| 561 | 558 |
| 562 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } | 559 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } |
| 563 | 560 |
| 564 // From QuicSession. | 561 // From QuicSession. |
| 565 MOCK_METHOD3(OnConnectionClosed, | 562 MOCK_METHOD3(OnConnectionClosed, |
| 566 void(QuicErrorCode error, | 563 void(QuicErrorCode error, |
| 567 const std::string& error_details, | 564 const std::string& error_details, |
| 568 ConnectionCloseSource source)); | 565 ConnectionCloseSource source)); |
| 569 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); | 566 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); |
| 570 MOCK_METHOD1(CreateOutgoingDynamicStream, | 567 MOCK_METHOD1(CreateOutgoingDynamicStream, |
| 571 QuicSpdyStream*(SpdyPriority priority)); | 568 QuicSpdyStream*(SpdyPriority priority)); |
| 572 MOCK_METHOD1(ShouldCreateIncomingDynamicStream, bool(QuicStreamId id)); | 569 MOCK_METHOD1(ShouldCreateIncomingDynamicStream, bool(QuicStreamId id)); |
| 573 MOCK_METHOD0(ShouldCreateOutgoingDynamicStream, bool()); | 570 MOCK_METHOD0(ShouldCreateOutgoingDynamicStream, bool()); |
| 574 MOCK_METHOD5(WritevData, | 571 MOCK_METHOD6(WritevData, |
| 575 QuicConsumedData(QuicStreamId id, | 572 QuicConsumedData(ReliableQuicStream* stream, |
| 573 QuicStreamId id, |
| 576 QuicIOVector data, | 574 QuicIOVector data, |
| 577 QuicStreamOffset offset, | 575 QuicStreamOffset offset, |
| 578 bool fin, | 576 bool fin, |
| 579 QuicAckListenerInterface*)); | 577 QuicAckListenerInterface*)); |
| 580 | 578 |
| 581 MOCK_METHOD3(SendRstStream, | 579 MOCK_METHOD3(SendRstStream, |
| 582 void(QuicStreamId stream_id, | 580 void(QuicStreamId stream_id, |
| 583 QuicRstStreamErrorCode error, | 581 QuicRstStreamErrorCode error, |
| 584 QuicStreamOffset bytes_written)); | 582 QuicStreamOffset bytes_written)); |
| 585 | 583 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 TestQuicSpdyServerSession** server_session); | 931 TestQuicSpdyServerSession** server_session); |
| 934 | 932 |
| 935 // Helper to generate client side stream ids, generalizes | 933 // Helper to generate client side stream ids, generalizes |
| 936 // kClientDataStreamId1 etc. above. | 934 // kClientDataStreamId1 etc. above. |
| 937 QuicStreamId QuicClientDataStreamId(int i); | 935 QuicStreamId QuicClientDataStreamId(int i); |
| 938 | 936 |
| 939 } // namespace test | 937 } // namespace test |
| 940 } // namespace net | 938 } // namespace net |
| 941 | 939 |
| 942 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 940 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |