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

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

Issue 1905843003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. No behavior change,… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119753783
Patch Set: Rebase Created 4 years, 8 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/tools/quic/quic_simple_server.cc ('k') | net/tools/quic/quic_simple_server_stream_test.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 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_simple_server_session.h" 5 #include "net/tools/quic/quic_simple_server_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 encryption_established_ = has_established; 99 encryption_established_ = has_established;
100 } 100 }
101 101
102 private: 102 private:
103 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); 103 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream);
104 }; 104 };
105 105
106 class MockConnectionWithSendStreamData : public MockConnection { 106 class MockConnectionWithSendStreamData : public MockConnection {
107 public: 107 public:
108 MockConnectionWithSendStreamData(MockConnectionHelper* helper, 108 MockConnectionWithSendStreamData(MockConnectionHelper* helper,
109 MockAlarmFactory* alarm_factory,
109 Perspective perspective, 110 Perspective perspective,
110 const QuicVersionVector& supported_versions) 111 const QuicVersionVector& supported_versions)
111 : MockConnection(helper, perspective, supported_versions) {} 112 : MockConnection(helper, alarm_factory, perspective, supported_versions) {
113 }
112 114
113 MOCK_METHOD5(SendStreamData, 115 MOCK_METHOD5(SendStreamData,
114 QuicConsumedData(QuicStreamId id, 116 QuicConsumedData(QuicStreamId id,
115 QuicIOVector iov, 117 QuicIOVector iov,
116 QuicStreamOffset offset, 118 QuicStreamOffset offset,
117 bool fin, 119 bool fin,
118 QuicAckListenerInterface* listern)); 120 QuicAckListenerInterface* listern));
119 }; 121 };
120 122
121 class QuicSimpleServerSessionPeer { 123 class QuicSimpleServerSessionPeer {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 compressed_certs_cache_( 163 compressed_certs_cache_(
162 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { 164 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
163 FLAGS_quic_always_log_bugs_for_tests = true; 165 FLAGS_quic_always_log_bugs_for_tests = true;
164 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); 166 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest);
165 config_.SetInitialStreamFlowControlWindowToSend( 167 config_.SetInitialStreamFlowControlWindowToSend(
166 kInitialStreamFlowControlWindowForTest); 168 kInitialStreamFlowControlWindowForTest);
167 config_.SetInitialSessionFlowControlWindowToSend( 169 config_.SetInitialSessionFlowControlWindowToSend(
168 kInitialSessionFlowControlWindowForTest); 170 kInitialSessionFlowControlWindowForTest);
169 171
170 connection_ = new StrictMock<MockConnectionWithSendStreamData>( 172 connection_ = new StrictMock<MockConnectionWithSendStreamData>(
171 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); 173 &helper_, &alarm_factory_, Perspective::IS_SERVER,
174 SupportedVersions(GetParam()));
172 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, 175 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_,
173 &crypto_config_, 176 &crypto_config_,
174 &compressed_certs_cache_)); 177 &compressed_certs_cache_));
175 MockClock clock; 178 MockClock clock;
176 handshake_message_.reset(crypto_config_.AddDefaultConfig( 179 handshake_message_.reset(crypto_config_.AddDefaultConfig(
177 QuicRandom::GetInstance(), &clock, 180 QuicRandom::GetInstance(), &clock,
178 QuicCryptoServerConfig::ConfigOptions())); 181 QuicCryptoServerConfig::ConfigOptions()));
179 session_->Initialize(); 182 session_->Initialize();
180 visitor_ = QuicConnectionPeer::GetVisitor(connection_); 183 visitor_ = QuicConnectionPeer::GetVisitor(connection_);
181 headers_stream_ = new MockQuicHeadersStream(session_.get()); 184 headers_stream_ = new MockQuicHeadersStream(session_.get());
182 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); 185 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_);
183 // TODO(jri): Remove this line once tests pass. 186 // TODO(jri): Remove this line once tests pass.
184 FLAGS_quic_cede_correctly = false; 187 FLAGS_quic_cede_correctly = false;
185 } 188 }
186 189
187 StrictMock<MockQuicServerSessionVisitor> owner_; 190 StrictMock<MockQuicServerSessionVisitor> owner_;
188 MockConnectionHelper helper_; 191 MockConnectionHelper helper_;
192 MockAlarmFactory alarm_factory_;
189 StrictMock<MockConnectionWithSendStreamData>* connection_; 193 StrictMock<MockConnectionWithSendStreamData>* connection_;
190 QuicConfig config_; 194 QuicConfig config_;
191 QuicCryptoServerConfig crypto_config_; 195 QuicCryptoServerConfig crypto_config_;
192 QuicCompressedCertsCache compressed_certs_cache_; 196 QuicCompressedCertsCache compressed_certs_cache_;
193 std::unique_ptr<QuicSimpleServerSession> session_; 197 std::unique_ptr<QuicSimpleServerSession> session_;
194 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; 198 std::unique_ptr<CryptoHandshakeMessage> handshake_message_;
195 QuicConnectionVisitorInterface* visitor_; 199 QuicConnectionVisitorInterface* visitor_;
196 MockQuicHeadersStream* headers_stream_; 200 MockQuicHeadersStream* headers_stream_;
197 }; 201 };
198 202
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // enough that it won't block any stream to write before stream level flow 400 // enough that it won't block any stream to write before stream level flow
397 // control blocks it. 401 // control blocks it.
398 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow( 402 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow(
399 &config_, kInitialSessionFlowControlWindowForTest); 403 &config_, kInitialSessionFlowControlWindowForTest);
400 // Enable server push. 404 // Enable server push.
401 QuicTagVector copt; 405 QuicTagVector copt;
402 copt.push_back(kSPSH); 406 copt.push_back(kSPSH);
403 QuicConfigPeer::SetReceivedConnectionOptions(&config_, copt); 407 QuicConfigPeer::SetReceivedConnectionOptions(&config_, copt);
404 408
405 connection_ = new StrictMock<MockConnectionWithSendStreamData>( 409 connection_ = new StrictMock<MockConnectionWithSendStreamData>(
406 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); 410 &helper_, &alarm_factory_, Perspective::IS_SERVER,
411 SupportedVersions(GetParam()));
407 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, 412 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_,
408 &crypto_config_, 413 &crypto_config_,
409 &compressed_certs_cache_)); 414 &compressed_certs_cache_));
410 session_->Initialize(); 415 session_->Initialize();
411 // Needed to make new session flow control window and server push work. 416 // Needed to make new session flow control window and server push work.
412 session_->OnConfigNegotiated(); 417 session_->OnConfigNegotiated();
413 418
414 visitor_ = QuicConnectionPeer::GetVisitor(connection_); 419 visitor_ = QuicConnectionPeer::GetVisitor(connection_);
415 headers_stream_ = new MockQuicHeadersStream(session_.get()); 420 headers_stream_ = new MockQuicHeadersStream(session_.get());
416 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); 421 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); 570 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false)));
566 571
567 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); 572 EXPECT_CALL(*connection_, SendBlocked(stream_to_open));
568 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); 573 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0);
569 visitor_->OnRstStream(rst); 574 visitor_->OnRstStream(rst);
570 } 575 }
571 576
572 } // namespace 577 } // namespace
573 } // namespace test 578 } // namespace test
574 } // namespace net 579 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server.cc ('k') | net/tools/quic/quic_simple_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698