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

Side by Side Diff: net/tools/quic/quic_dispatcher_test.cc

Issue 1782743005: Add QuicCompressedCertsCache* to QuicCrytoServerStream plumbed from QuicServerSessionBase. No behav… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116387934
Patch Set: Created 4 years, 9 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_test_utils.cc ('k') | net/tools/quic/quic_server_session_base.h » ('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 #include "net/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 crypto_stream_(QuicServerSessionBase::GetCryptoStream()) {} 60 crypto_stream_(QuicServerSessionBase::GetCryptoStream()) {}
61 ~TestQuicSpdyServerSession() override{}; 61 ~TestQuicSpdyServerSession() override{};
62 62
63 MOCK_METHOD2(OnConnectionClosed, 63 MOCK_METHOD2(OnConnectionClosed,
64 void(QuicErrorCode error, ConnectionCloseSource source)); 64 void(QuicErrorCode error, ConnectionCloseSource source));
65 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id)); 65 MOCK_METHOD1(CreateIncomingDynamicStream, QuicSpdyStream*(QuicStreamId id));
66 MOCK_METHOD1(CreateOutgoingDynamicStream, 66 MOCK_METHOD1(CreateOutgoingDynamicStream,
67 QuicSpdyStream*(SpdyPriority priority)); 67 QuicSpdyStream*(SpdyPriority priority));
68 68
69 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream( 69 QuicCryptoServerStreamBase* CreateQuicCryptoServerStream(
70 const QuicCryptoServerConfig* crypto_config) override { 70 const QuicCryptoServerConfig* crypto_config,
71 QuicCompressedCertsCache* compressed_certs_cache) override {
71 return new QuicCryptoServerStream( 72 return new QuicCryptoServerStream(
72 crypto_config, FLAGS_enable_quic_stateless_reject_support, this); 73 crypto_config, compressed_certs_cache,
74 FLAGS_enable_quic_stateless_reject_support, this);
73 } 75 }
74 76
75 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { 77 void SetCryptoStream(QuicCryptoServerStream* crypto_stream) {
76 crypto_stream_ = crypto_stream; 78 crypto_stream_ = crypto_stream;
77 } 79 }
78 80
79 QuicCryptoServerStreamBase* GetCryptoStream() override { 81 QuicCryptoServerStreamBase* GetCryptoStream() override {
80 return crypto_stream_; 82 return crypto_stream_;
81 } 83 }
82 84
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 .Times(1); 390 .Times(1);
389 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) 391 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
390 .Times(1); 392 .Times(1);
391 ProcessPacket(client_address, connection_id, false, false, "data"); 393 ProcessPacket(client_address, connection_id, false, false, "data");
392 } 394 }
393 395
394 // Enables mocking of the handshake-confirmation for stateless rejects. 396 // Enables mocking of the handshake-confirmation for stateless rejects.
395 class MockQuicCryptoServerStream : public QuicCryptoServerStream { 397 class MockQuicCryptoServerStream : public QuicCryptoServerStream {
396 public: 398 public:
397 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config, 399 MockQuicCryptoServerStream(const QuicCryptoServerConfig& crypto_config,
400 QuicCompressedCertsCache* compressed_certs_cache,
398 QuicSession* session) 401 QuicSession* session)
399 : QuicCryptoServerStream(&crypto_config, 402 : QuicCryptoServerStream(&crypto_config,
403 compressed_certs_cache,
400 FLAGS_enable_quic_stateless_reject_support, 404 FLAGS_enable_quic_stateless_reject_support,
401 session) {} 405 session) {}
402 void set_handshake_confirmed_for_testing(bool handshake_confirmed) { 406 void set_handshake_confirmed_for_testing(bool handshake_confirmed) {
403 handshake_confirmed_ = handshake_confirmed; 407 handshake_confirmed_ = handshake_confirmed;
404 } 408 }
405 409
406 private: 410 private:
407 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); 411 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream);
408 }; 412 };
409 413
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 483
480 // Sets up dispatcher_, sesession1_, and crypto_stream1_ based on 484 // Sets up dispatcher_, sesession1_, and crypto_stream1_ based on
481 // the test parameters. 485 // the test parameters.
482 QuicServerSessionBase* CreateSessionBasedOnTestParams( 486 QuicServerSessionBase* CreateSessionBasedOnTestParams(
483 QuicConnectionId connection_id, 487 QuicConnectionId connection_id,
484 const IPEndPoint& client_address) { 488 const IPEndPoint& client_address) {
485 CreateSession(&dispatcher_, config_, connection_id, client_address, 489 CreateSession(&dispatcher_, config_, connection_id, client_address,
486 &mock_helper_, &crypto_config_, 490 &mock_helper_, &crypto_config_,
487 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_); 491 QuicDispatcherPeer::GetCache(&dispatcher_), &session1_);
488 492
489 crypto_stream1_ = new MockQuicCryptoServerStream(crypto_config_, session1_); 493 crypto_stream1_ = new MockQuicCryptoServerStream(
494 crypto_config_, QuicDispatcherPeer::GetCache(&dispatcher_), session1_);
490 session1_->SetCryptoStream(crypto_stream1_); 495 session1_->SetCryptoStream(crypto_stream1_);
491 crypto_stream1_->set_handshake_confirmed_for_testing( 496 crypto_stream1_->set_handshake_confirmed_for_testing(
492 GetParam().crypto_handshake_successful); 497 GetParam().crypto_handshake_successful);
493 crypto_stream1_->SetPeerSupportsStatelessRejects( 498 crypto_stream1_->SetPeerSupportsStatelessRejects(
494 GetParam().client_supports_statelesss_rejects); 499 GetParam().client_supports_statelesss_rejects);
495 return session1_; 500 return session1_;
496 } 501 }
497 502
498 MockQuicCryptoServerStream* crypto_stream1_; 503 MockQuicCryptoServerStream* crypto_stream1_;
499 }; 504 };
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 834
830 // And we'll resume where we left off when we get another call. 835 // And we'll resume where we left off when we get another call.
831 EXPECT_CALL(*connection2(), OnCanWrite()); 836 EXPECT_CALL(*connection2(), OnCanWrite());
832 dispatcher_.OnCanWrite(); 837 dispatcher_.OnCanWrite();
833 EXPECT_FALSE(dispatcher_.HasPendingWrites()); 838 EXPECT_FALSE(dispatcher_.HasPendingWrites());
834 } 839 }
835 840
836 } // namespace 841 } // namespace
837 } // namespace test 842 } // namespace test
838 } // namespace net 843 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_server_session_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698