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

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

Issue 2226643004: QuicSession no longer directly owns its QuicConnection. Not flag protected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129226757
Patch Set: Created 4 years, 4 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/core/quic_spdy_session.h ('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 <stddef.h> 10 #include <stddef.h>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 void SendOrQueuePacket(SerializedPacket* packet) override; 491 void SendOrQueuePacket(SerializedPacket* packet) override;
492 492
493 std::vector<QuicEncryptedPacket*> encrypted_packets_; 493 std::vector<QuicEncryptedPacket*> encrypted_packets_;
494 494
495 private: 495 private:
496 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection); 496 DISALLOW_COPY_AND_ASSIGN(PacketSavingConnection);
497 }; 497 };
498 498
499 class MockQuicSession : public QuicSession { 499 class MockQuicSession : public QuicSession {
500 public: 500 public:
501 // Takes ownership of |connection|.
501 explicit MockQuicSession(QuicConnection* connection); 502 explicit MockQuicSession(QuicConnection* connection);
502 ~MockQuicSession() override; 503 ~MockQuicSession() override;
503 504
504 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } 505 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); }
505 506
506 MOCK_METHOD3(OnConnectionClosed, 507 MOCK_METHOD3(OnConnectionClosed,
507 void(QuicErrorCode error, 508 void(QuicErrorCode error,
508 const std::string& error_details, 509 const std::string& error_details,
509 ConnectionCloseSource source)); 510 ConnectionCloseSource source));
510 MOCK_METHOD1(CreateIncomingDynamicStream, 511 MOCK_METHOD1(CreateIncomingDynamicStream,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 QuicAckListenerInterface* ack_notifier_delegate); 548 QuicAckListenerInterface* ack_notifier_delegate);
548 549
549 private: 550 private:
550 std::unique_ptr<QuicCryptoStream> crypto_stream_; 551 std::unique_ptr<QuicCryptoStream> crypto_stream_;
551 552
552 DISALLOW_COPY_AND_ASSIGN(MockQuicSession); 553 DISALLOW_COPY_AND_ASSIGN(MockQuicSession);
553 }; 554 };
554 555
555 class MockQuicSpdySession : public QuicSpdySession { 556 class MockQuicSpdySession : public QuicSpdySession {
556 public: 557 public:
558 // Takes ownership of |connection|.
557 explicit MockQuicSpdySession(QuicConnection* connection); 559 explicit MockQuicSpdySession(QuicConnection* connection);
558 ~MockQuicSpdySession() override; 560 ~MockQuicSpdySession() override;
559 561
560 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); } 562 QuicCryptoStream* GetCryptoStream() override { return crypto_stream_.get(); }
561 const SpdyHeaderBlock& GetWriteHeaders() { return write_headers_; } 563 const SpdyHeaderBlock& GetWriteHeaders() { return write_headers_; }
562 564
563 // From QuicSession. 565 // From QuicSession.
564 MOCK_METHOD3(OnConnectionClosed, 566 MOCK_METHOD3(OnConnectionClosed,
565 void(QuicErrorCode error, 567 void(QuicErrorCode error,
566 const std::string& error_details, 568 const std::string& error_details,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 635
634 private: 636 private:
635 std::unique_ptr<QuicCryptoStream> crypto_stream_; 637 std::unique_ptr<QuicCryptoStream> crypto_stream_;
636 SpdyHeaderBlock write_headers_; 638 SpdyHeaderBlock write_headers_;
637 639
638 DISALLOW_COPY_AND_ASSIGN(MockQuicSpdySession); 640 DISALLOW_COPY_AND_ASSIGN(MockQuicSpdySession);
639 }; 641 };
640 642
641 class TestQuicSpdyServerSession : public QuicServerSessionBase { 643 class TestQuicSpdyServerSession : public QuicServerSessionBase {
642 public: 644 public:
645 // Takes ownership of |connection|.
643 TestQuicSpdyServerSession(QuicConnection* connection, 646 TestQuicSpdyServerSession(QuicConnection* connection,
644 const QuicConfig& config, 647 const QuicConfig& config,
645 const QuicCryptoServerConfig* crypto_config, 648 const QuicCryptoServerConfig* crypto_config,
646 QuicCompressedCertsCache* compressed_certs_cache); 649 QuicCompressedCertsCache* compressed_certs_cache);
647 ~TestQuicSpdyServerSession() override; 650 ~TestQuicSpdyServerSession() override;
648 651
649 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); 652 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id));
650 MOCK_METHOD1(CreateOutgoingDynamicStream, 653 MOCK_METHOD1(CreateOutgoingDynamicStream,
651 QuicSpdyStream*(SpdyPriority priority)); 654 QuicSpdyStream*(SpdyPriority priority));
652 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( 655 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream(
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 TestQuicSpdyServerSession** server_session); 1021 TestQuicSpdyServerSession** server_session);
1019 1022
1020 // Helper to generate client side stream ids, generalizes 1023 // Helper to generate client side stream ids, generalizes
1021 // kClientDataStreamId1 etc. above. 1024 // kClientDataStreamId1 etc. above.
1022 QuicStreamId QuicClientDataStreamId(int i); 1025 QuicStreamId QuicClientDataStreamId(int i);
1023 1026
1024 } // namespace test 1027 } // namespace test
1025 } // namespace net 1028 } // namespace net
1026 1029
1027 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 1030 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_session.h ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698