Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: net/quic/test_tools/quic_test_utils.h

Issue 1190823003: Remove dependency on headers stream from QuicSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0616
Patch Set: deleted an include Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_spdy_session_peer.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 MOCK_METHOD1(OnBlockedFrames, 282 MOCK_METHOD1(OnBlockedFrames,
283 void(const std::vector<QuicBlockedFrame>& frame)); 283 void(const std::vector<QuicBlockedFrame>& frame));
284 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame)); 284 MOCK_METHOD1(OnRstStream, void(const QuicRstStreamFrame& frame));
285 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame)); 285 MOCK_METHOD1(OnGoAway, void(const QuicGoAwayFrame& frame));
286 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); 286 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer));
287 MOCK_METHOD0(OnWriteBlocked, void()); 287 MOCK_METHOD0(OnWriteBlocked, void());
288 MOCK_METHOD0(OnCanWrite, void()); 288 MOCK_METHOD0(OnCanWrite, void());
289 MOCK_METHOD1(OnCongestionWindowChange, void(QuicTime now)); 289 MOCK_METHOD1(OnCongestionWindowChange, void(QuicTime now));
290 MOCK_CONST_METHOD0(WillingAndAbleToWrite, bool()); 290 MOCK_CONST_METHOD0(WillingAndAbleToWrite, bool());
291 MOCK_CONST_METHOD0(HasPendingHandshake, bool()); 291 MOCK_CONST_METHOD0(HasPendingHandshake, bool());
292 MOCK_CONST_METHOD0(HasOpenDataStreams, bool()); 292 MOCK_CONST_METHOD0(HasOpenDynamicStreams, bool());
293 MOCK_METHOD1(OnSuccessfulVersionNegotiation, 293 MOCK_METHOD1(OnSuccessfulVersionNegotiation,
294 void(const QuicVersion& version)); 294 void(const QuicVersion& version));
295 MOCK_METHOD0(OnConfigNegotiated, void()); 295 MOCK_METHOD0(OnConfigNegotiated, void());
296 296
297 private: 297 private:
298 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor); 298 DISALLOW_COPY_AND_ASSIGN(MockConnectionVisitor);
299 }; 299 };
300 300
301 class MockHelper : public QuicConnectionHelperInterface { 301 class MockHelper : public QuicConnectionHelperInterface {
302 public: 302 public:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 ~PacketSavingConnection() override; 415 ~PacketSavingConnection() override;
416 416
417 void SendOrQueuePacket(QueuedPacket packet) override; 417 void SendOrQueuePacket(QueuedPacket packet) override;
418 418
419 std::vector<QuicEncryptedPacket*> encrypted_packets_; 419 std::vector<QuicEncryptedPacket*> encrypted_packets_;
420 420
421 private: 421 private:
422 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); 422 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection);
423 }; 423 };
424 424
425 class MockSession : public QuicSession { 425 class MockQuicSpdySession : public QuicSpdySession {
426 public: 426 public:
427 explicit MockSession(QuicConnection* connection); 427 explicit MockQuicSpdySession(QuicConnection* connection);
428 ~MockSession() override; 428 ~MockQuicSpdySession() override;
429 429
430 QuicCryptoStream* GetCryptoStream() { return crypto_stream_.get(); } 430 QuicCryptoStream* GetCryptoStream() { return crypto_stream_.get(); }
431 431
432 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); 432 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer));
433 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); 433 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id));
434 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); 434 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*());
435 MOCK_METHOD6(WritevData, 435 MOCK_METHOD6(WritevData,
436 QuicConsumedData(QuicStreamId id, 436 QuicConsumedData(QuicStreamId id,
437 const IOVector& data, 437 const IOVector& data,
438 QuicStreamOffset offset, 438 QuicStreamOffset offset,
439 bool fin, 439 bool fin,
440 FecProtection fec_protection, 440 FecProtection fec_protection,
441 QuicAckNotifier::DelegateInterface*)); 441 QuicAckNotifier::DelegateInterface*));
442 MOCK_METHOD2(OnStreamHeaders, void(QuicStreamId stream_id, 442 MOCK_METHOD2(OnStreamHeaders, void(QuicStreamId stream_id,
443 base::StringPiece headers_data)); 443 base::StringPiece headers_data));
444 MOCK_METHOD2(OnStreamHeadersPriority, void(QuicStreamId stream_id, 444 MOCK_METHOD2(OnStreamHeadersPriority, void(QuicStreamId stream_id,
445 QuicPriority priority)); 445 QuicPriority priority));
446 MOCK_METHOD3(OnStreamHeadersComplete, void(QuicStreamId stream_id, 446 MOCK_METHOD3(OnStreamHeadersComplete, void(QuicStreamId stream_id,
447 bool fin, 447 bool fin,
448 size_t frame_len)); 448 size_t frame_len));
449 MOCK_METHOD3(SendRstStream, void(QuicStreamId stream_id, 449 MOCK_METHOD3(SendRstStream, void(QuicStreamId stream_id,
450 QuicRstStreamErrorCode error, 450 QuicRstStreamErrorCode error,
451 QuicStreamOffset bytes_written)); 451 QuicStreamOffset bytes_written));
452 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); 452 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool());
453 453
454 using QuicSession::ActivateStream; 454 using QuicSession::ActivateStream;
455 455
456 private: 456 private:
457 scoped_ptr<QuicCryptoStream> crypto_stream_; 457 scoped_ptr<QuicCryptoStream> crypto_stream_;
458 458
459 DISALLOW_COPY_AND_ASSIGN(MockSession); 459 DISALLOW_COPY_AND_ASSIGN(MockQuicSpdySession);
460 }; 460 };
461 461
462 class TestServerSession : public QuicSession { 462 class TestQuicSpdyServerSession : public QuicSpdySession {
463 public: 463 public:
464 TestServerSession(QuicConnection* connection, 464 TestQuicSpdyServerSession(QuicConnection* connection,
465 const QuicConfig& config, 465 const QuicConfig& config,
466 const QuicCryptoServerConfig* crypto_config); 466 const QuicCryptoServerConfig* crypto_config);
467 ~TestServerSession() override; 467 ~TestQuicSpdyServerSession() override;
468 468
469 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); 469 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id));
470 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); 470 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*());
471 471
472 QuicCryptoServerStream* GetCryptoStream() override; 472 QuicCryptoServerStream* GetCryptoStream() override;
473 473
474 private: 474 private:
475 scoped_ptr<QuicCryptoServerStream> crypto_stream_; 475 scoped_ptr<QuicCryptoServerStream> crypto_stream_;
476 476
477 DISALLOW_COPY_AND_ASSIGN(TestServerSession); 477 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyServerSession);
478 }; 478 };
479 479
480 class TestClientSession : public QuicClientSessionBase { 480 class TestQuicSpdyClientSession : public QuicClientSessionBase {
481 public: 481 public:
482 TestClientSession(QuicConnection* connection, 482 TestQuicSpdyClientSession(QuicConnection* connection,
483 const QuicConfig& config, 483 const QuicConfig& config,
484 const QuicServerId& server_id, 484 const QuicServerId& server_id,
485 QuicCryptoClientConfig* crypto_config); 485 QuicCryptoClientConfig* crypto_config);
486 ~TestClientSession() override; 486 ~TestQuicSpdyClientSession() override;
487 487
488 // QuicClientSessionBase 488 // QuicClientSessionBase
489 MOCK_METHOD1(OnProofValid, 489 MOCK_METHOD1(OnProofValid,
490 void(const QuicCryptoClientConfig::CachedState& cached)); 490 void(const QuicCryptoClientConfig::CachedState& cached));
491 MOCK_METHOD1(OnProofVerifyDetailsAvailable, 491 MOCK_METHOD1(OnProofVerifyDetailsAvailable,
492 void(const ProofVerifyDetails& verify_details)); 492 void(const ProofVerifyDetails& verify_details));
493 493
494 // TestClientSession 494 // TestQuicSpdyClientSession
495 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); 495 MOCK_METHOD1(CreateIncomingDynamicStream, QuicDataStream*(QuicStreamId id));
496 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); 496 MOCK_METHOD0(CreateOutgoingDynamicStream, QuicDataStream*());
497 497
498 QuicCryptoClientStream* GetCryptoStream() override; 498 QuicCryptoClientStream* GetCryptoStream() override;
499 499
500 private: 500 private:
501 scoped_ptr<QuicCryptoClientStream> crypto_stream_; 501 scoped_ptr<QuicCryptoClientStream> crypto_stream_;
502 502
503 DISALLOW_COPY_AND_ASSIGN(TestClientSession); 503 DISALLOW_COPY_AND_ASSIGN(TestQuicSpdyClientSession);
504 }; 504 };
505 505
506 class MockPacketWriter : public QuicPacketWriter { 506 class MockPacketWriter : public QuicPacketWriter {
507 public: 507 public:
508 MockPacketWriter(); 508 MockPacketWriter();
509 ~MockPacketWriter() override; 509 ~MockPacketWriter() override;
510 510
511 MOCK_METHOD4(WritePacket, 511 MOCK_METHOD4(WritePacket,
512 WriteResult(const char* buffer, 512 WriteResult(const char* buffer,
513 size_t buf_len, 513 size_t buf_len,
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 // client_connection: Pointer reference for newly created 732 // client_connection: Pointer reference for newly created
733 // connection. This object will be owned by the 733 // connection. This object will be owned by the
734 // client_session. 734 // client_session.
735 // client_session: Pointer reference for the newly created client 735 // client_session: Pointer reference for the newly created client
736 // session. The new object will be owned by the caller. 736 // session. The new object will be owned by the caller.
737 void CreateClientSessionForTest(QuicServerId server_id, 737 void CreateClientSessionForTest(QuicServerId server_id,
738 bool supports_stateless_rejects, 738 bool supports_stateless_rejects,
739 QuicTime::Delta connection_start_time, 739 QuicTime::Delta connection_start_time,
740 QuicCryptoClientConfig* crypto_client_config, 740 QuicCryptoClientConfig* crypto_client_config,
741 PacketSavingConnection** client_connection, 741 PacketSavingConnection** client_connection,
742 TestClientSession** client_session); 742 TestQuicSpdyClientSession** client_session);
743 743
744 // Creates a server session for testing. 744 // Creates a server session for testing.
745 // 745 //
746 // server_id: The server id associated with this stream. 746 // server_id: The server id associated with this stream.
747 // connection_start_time: The time to set for the connection clock. 747 // connection_start_time: The time to set for the connection clock.
748 // Needed for strike-register nonce verification. The server 748 // Needed for strike-register nonce verification. The server
749 // connection_start_time should be synchronized witht the client 749 // connection_start_time should be synchronized witht the client
750 // start time, otherwise nonce verification will fail. 750 // start time, otherwise nonce verification will fail.
751 // crypto_server_config: Pointer to the crypto server config. 751 // crypto_server_config: Pointer to the crypto server config.
752 // server_connection: Pointer reference for newly created 752 // server_connection: Pointer reference for newly created
753 // connection. This object will be owned by the 753 // connection. This object will be owned by the
754 // server_session. 754 // server_session.
755 // server_session: Pointer reference for the newly created server 755 // server_session: Pointer reference for the newly created server
756 // session. The new object will be owned by the caller. 756 // session. The new object will be owned by the caller.
757 void CreateServerSessionForTest(QuicServerId server_id, 757 void CreateServerSessionForTest(QuicServerId server_id,
758 QuicTime::Delta connection_start_time, 758 QuicTime::Delta connection_start_time,
759 QuicCryptoServerConfig* crypto_server_config, 759 QuicCryptoServerConfig* crypto_server_config,
760 PacketSavingConnection** server_connection, 760 PacketSavingConnection** server_connection,
761 TestServerSession** server_session); 761 TestQuicSpdyServerSession** server_session);
762 762
763 } // namespace test 763 } // namespace test
764 } // namespace net 764 } // namespace net
765 765
766 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 766 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_spdy_session_peer.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698