OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_server_session_base.h" | 5 #include "net/tools/quic/quic_server_session_base.h" |
6 | 6 |
| 7 #include <cstdint> |
| 8 #include <memory> |
| 9 |
7 #include "base/macros.h" | 10 #include "base/macros.h" |
8 #include "net/quic/crypto/quic_crypto_server_config.h" | 11 #include "net/quic/crypto/quic_crypto_server_config.h" |
9 #include "net/quic/crypto/quic_random.h" | 12 #include "net/quic/crypto/quic_random.h" |
10 #include "net/quic/proto/cached_network_parameters.pb.h" | 13 #include "net/quic/proto/cached_network_parameters.pb.h" |
11 #include "net/quic/quic_connection.h" | 14 #include "net/quic/quic_connection.h" |
12 #include "net/quic/quic_crypto_server_stream.h" | 15 #include "net/quic/quic_crypto_server_stream.h" |
13 #include "net/quic/quic_utils.h" | 16 #include "net/quic/quic_utils.h" |
14 #include "net/quic/test_tools/crypto_test_utils.h" | 17 #include "net/quic/test_tools/crypto_test_utils.h" |
15 #include "net/quic/test_tools/quic_config_peer.h" | 18 #include "net/quic/test_tools/quic_config_peer.h" |
16 #include "net/quic/test_tools/quic_connection_peer.h" | 19 #include "net/quic/test_tools/quic_connection_peer.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 CryptoTestUtils::ProofSourceForTesting()), | 127 CryptoTestUtils::ProofSourceForTesting()), |
125 compressed_certs_cache_( | 128 compressed_certs_cache_( |
126 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 129 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
127 FLAGS_quic_always_log_bugs_for_tests = true; | 130 FLAGS_quic_always_log_bugs_for_tests = true; |
128 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 131 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
129 config_.SetInitialStreamFlowControlWindowToSend( | 132 config_.SetInitialStreamFlowControlWindowToSend( |
130 kInitialStreamFlowControlWindowForTest); | 133 kInitialStreamFlowControlWindowForTest); |
131 config_.SetInitialSessionFlowControlWindowToSend( | 134 config_.SetInitialSessionFlowControlWindowToSend( |
132 kInitialSessionFlowControlWindowForTest); | 135 kInitialSessionFlowControlWindowForTest); |
133 | 136 |
134 connection_ = new StrictMock<MockConnection>( | 137 connection_ = new StrictMock<MockConnection>(&helper_, &alarm_factory_, |
135 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); | 138 Perspective::IS_SERVER, |
| 139 SupportedVersions(GetParam())); |
136 session_.reset(new TestServerSession(config_, connection_, &owner_, | 140 session_.reset(new TestServerSession(config_, connection_, &owner_, |
137 &crypto_config_, | 141 &crypto_config_, |
138 &compressed_certs_cache_)); | 142 &compressed_certs_cache_)); |
139 MockClock clock; | 143 MockClock clock; |
140 handshake_message_.reset(crypto_config_.AddDefaultConfig( | 144 handshake_message_.reset(crypto_config_.AddDefaultConfig( |
141 QuicRandom::GetInstance(), &clock, | 145 QuicRandom::GetInstance(), &clock, |
142 QuicCryptoServerConfig::ConfigOptions())); | 146 QuicCryptoServerConfig::ConfigOptions())); |
143 session_->Initialize(); | 147 session_->Initialize(); |
144 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 148 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
145 } | 149 } |
146 | 150 |
147 StrictMock<MockQuicServerSessionVisitor> owner_; | 151 StrictMock<MockQuicServerSessionVisitor> owner_; |
148 MockConnectionHelper helper_; | 152 MockConnectionHelper helper_; |
| 153 MockAlarmFactory alarm_factory_; |
149 StrictMock<MockConnection>* connection_; | 154 StrictMock<MockConnection>* connection_; |
150 QuicConfig config_; | 155 QuicConfig config_; |
151 QuicCryptoServerConfig crypto_config_; | 156 QuicCryptoServerConfig crypto_config_; |
152 QuicCompressedCertsCache compressed_certs_cache_; | 157 QuicCompressedCertsCache compressed_certs_cache_; |
153 std::unique_ptr<TestServerSession> session_; | 158 std::unique_ptr<TestServerSession> session_; |
154 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; | 159 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; |
155 QuicConnectionVisitorInterface* visitor_; | 160 QuicConnectionVisitorInterface* visitor_; |
156 }; | 161 }; |
157 | 162 |
158 // Compares CachedNetworkParameters. | 163 // Compares CachedNetworkParameters. |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 EXPECT_FALSE( | 549 EXPECT_FALSE( |
545 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 550 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
546 session_->OnConfigNegotiated(); | 551 session_->OnConfigNegotiated(); |
547 EXPECT_FALSE( | 552 EXPECT_FALSE( |
548 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 553 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
549 } | 554 } |
550 | 555 |
551 } // namespace | 556 } // namespace |
552 } // namespace test | 557 } // namespace test |
553 } // namespace net | 558 } // namespace net |
OLD | NEW |