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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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_server.cc ('k') | net/tools/quic/quic_socket_utils.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 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.h" 5 #include "net/tools/quic/quic_server_session.h"
6 6
7 #include "net/quic/crypto/cached_network_parameters.h" 7 #include "net/quic/crypto/cached_network_parameters.h"
8 #include "net/quic/crypto/quic_crypto_server_config.h" 8 #include "net/quic/crypto/quic_crypto_server_config.h"
9 #include "net/quic/crypto/quic_random.h" 9 #include "net/quic/crypto/quic_random.h"
10 #include "net/quic/quic_connection.h" 10 #include "net/quic/quic_connection.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 QuicStreamFrame(kClientDataStreamId1, false, 2, MakeIOVector("TP"))); 185 QuicStreamFrame(kClientDataStreamId1, false, 2, MakeIOVector("TP")));
186 frames.push_back( 186 frames.push_back(
187 QuicStreamFrame(kClientDataStreamId2, false, 2, MakeIOVector("TP"))); 187 QuicStreamFrame(kClientDataStreamId2, false, 2, MakeIOVector("TP")));
188 visitor_->OnStreamFrames(frames); 188 visitor_->OnStreamFrames(frames);
189 // The stream should never be opened, now that the reset is received. 189 // The stream should never be opened, now that the reset is received.
190 EXPECT_EQ(1u, session_->GetNumOpenStreams()); 190 EXPECT_EQ(1u, session_->GetNumOpenStreams());
191 EXPECT_TRUE(connection_->connected()); 191 EXPECT_TRUE(connection_->connected());
192 } 192 }
193 193
194 TEST_P(QuicServerSessionTest, MaxOpenStreams) { 194 TEST_P(QuicServerSessionTest, MaxOpenStreams) {
195 ValueRestore<bool> old_flag(&FLAGS_quic_allow_more_open_streams, true);
196 // Test that the server closes the connection if a client attempts to open too 195 // Test that the server closes the connection if a client attempts to open too
197 // many data streams. The server accepts slightly more than the negotiated 196 // many data streams. The server accepts slightly more than the negotiated
198 // stream limit to deal with rare cases where a client FIN/RST is lost. 197 // stream limit to deal with rare cases where a client FIN/RST is lost.
199 198
200 // The slightly increased stream limit is set during config negotiation. It 199 // The slightly increased stream limit is set during config negotiation. It
201 // should be either an increase of 10 over negotiated limit, or a fixed 200 // should be either an increase of 10 over negotiated limit, or a fixed
202 // percentage scaling, whichever is larger. Test both before continuing. 201 // percentage scaling, whichever is larger. Test both before continuing.
203 EXPECT_EQ(kMaxStreamsForTest, session_->get_max_open_streams()); 202 EXPECT_EQ(kMaxStreamsForTest, session_->get_max_open_streams());
204 session_->OnConfigNegotiated(); 203 session_->OnConfigNegotiated();
205 EXPECT_LT(kMaxStreamsMultiplier * kMaxStreamsForTest, 204 EXPECT_LT(kMaxStreamsMultiplier * kMaxStreamsForTest,
(...skipping 17 matching lines...) Expand all
223 } 222 }
224 223
225 // Now violate the server's internal stream limit. 224 // Now violate the server's internal stream limit.
226 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS)); 225 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS));
227 stream_id += 2; 226 stream_id += 2;
228 EXPECT_FALSE( 227 EXPECT_FALSE(
229 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), stream_id)); 228 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), stream_id));
230 } 229 }
231 230
232 TEST_P(QuicServerSessionTest, MaxOpenStreamsImplicit) { 231 TEST_P(QuicServerSessionTest, MaxOpenStreamsImplicit) {
233 ValueRestore<bool> old_flag(&FLAGS_quic_allow_more_open_streams, true);
234 // Test that the server closes the connection if a client attempts to open too 232 // Test that the server closes the connection if a client attempts to open too
235 // many data streams implicitly. The server accepts slightly more than the 233 // many data streams implicitly. The server accepts slightly more than the
236 // negotiated stream limit to deal with rare cases where a client FIN/RST is 234 // negotiated stream limit to deal with rare cases where a client FIN/RST is
237 // lost. 235 // lost.
238 236
239 // The slightly increased stream limit is set during config negotiation. 237 // The slightly increased stream limit is set during config negotiation.
240 EXPECT_EQ(kMaxStreamsForTest, session_->get_max_open_streams()); 238 EXPECT_EQ(kMaxStreamsForTest, session_->get_max_open_streams());
241 session_->OnConfigNegotiated(); 239 session_->OnConfigNegotiated();
242 EXPECT_LT(kMaxStreamsMultiplier * kMaxStreamsForTest, 240 EXPECT_LT(kMaxStreamsMultiplier * kMaxStreamsForTest,
243 kMaxStreamsForTest + kMaxStreamsMinimumIncrement); 241 kMaxStreamsForTest + kMaxStreamsMinimumIncrement);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 cached_network_params.set_serving_region(kTestServingRegion); 418 cached_network_params.set_serving_region(kTestServingRegion);
421 crypto_stream->set_previous_cached_network_params(cached_network_params); 419 crypto_stream->set_previous_cached_network_params(cached_network_params);
422 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); 420 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1);
423 session_->OnConfigNegotiated(); 421 session_->OnConfigNegotiated();
424 } 422 }
425 423
426 } // namespace 424 } // namespace
427 } // namespace test 425 } // namespace test
428 } // namespace tools 426 } // namespace tools
429 } // namespace net 427 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698