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

Side by Side Diff: net/quic/quic_session_test.cc

Issue 1337113006: relnote: Deprecate FLAGS_exact_stream_id_delta, which has always (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/quic_session.cc ('k') | net/tools/quic/quic_server_session.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 #include "net/quic/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 session_.GetIncomingDynamicStream(stream_id); 323 session_.GetIncomingDynamicStream(stream_id);
324 EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0); 324 EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0);
325 EXPECT_NE(nullptr, 325 EXPECT_NE(nullptr,
326 session_.GetIncomingDynamicStream( 326 session_.GetIncomingDynamicStream(
327 stream_id + 2 * (session_.get_max_open_streams() - 1))); 327 stream_id + 2 * (session_.get_max_open_streams() - 1)));
328 } 328 }
329 329
330 TEST_P(QuicSessionTestServer, TooManyImplicitlyOpenedStreams) { 330 TEST_P(QuicSessionTestServer, TooManyImplicitlyOpenedStreams) {
331 QuicStreamId stream_id1 = kClientDataStreamId1; 331 QuicStreamId stream_id1 = kClientDataStreamId1;
332 // A stream ID which is too large to create. 332 // A stream ID which is too large to create.
333 const QuicStreamId kMaxStreamIdDelta = 200; 333 QuicStreamId stream_id2 = stream_id1 + 2 * session_.get_max_open_streams();
334 QuicStreamId stream_id2 =
335 FLAGS_exact_stream_id_delta
336 ? stream_id1 + 2 * session_.get_max_open_streams()
337 : stream_id1 + kMaxStreamIdDelta + 2;
338 EXPECT_NE(nullptr, session_.GetIncomingDynamicStream(stream_id1)); 334 EXPECT_NE(nullptr, session_.GetIncomingDynamicStream(stream_id1));
339 EXPECT_CALL(*connection_, SendConnectionClose(FLAGS_exact_stream_id_delta 335 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS));
340 ? QUIC_TOO_MANY_OPEN_STREAMS
341 : QUIC_INVALID_STREAM_ID));
342 EXPECT_EQ(nullptr, session_.GetIncomingDynamicStream(stream_id2)); 336 EXPECT_EQ(nullptr, session_.GetIncomingDynamicStream(stream_id2));
343 } 337 }
344 338
345 TEST_P(QuicSessionTestServer, ManyImplicitlyOpenedStreams) { 339 TEST_P(QuicSessionTestServer, ManyImplicitlyOpenedStreams) {
346 // When max_open_streams_ is 200, should be able to create 200 streams 340 // When max_open_streams_ is 200, should be able to create 200 streams
347 // out-of-order, that is, creating the one with the largest stream ID first. 341 // out-of-order, that is, creating the one with the largest stream ID first.
348 QuicSessionPeer::SetMaxOpenStreams(&session_, 200); 342 QuicSessionPeer::SetMaxOpenStreams(&session_, 200);
349 QuicStreamId stream_id = kClientDataStreamId1; 343 QuicStreamId stream_id = kClientDataStreamId1;
350 // Create one stream. 344 // Create one stream.
351 session_.GetIncomingDynamicStream(stream_id); 345 session_.GetIncomingDynamicStream(stream_id);
352 EXPECT_CALL(*connection_, SendConnectionClose(_)) 346 EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0);
353 .Times(FLAGS_exact_stream_id_delta ? 0 : 1);
354 // Create the largest stream ID of a threatened total of 200 streams. 347 // Create the largest stream ID of a threatened total of 200 streams.
355 session_.GetIncomingDynamicStream(stream_id + 2 * (200 - 1)); 348 session_.GetIncomingDynamicStream(stream_id + 2 * (200 - 1));
356 } 349 }
357 350
358 TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) { 351 TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) {
359 TestStream* stream2 = session_.CreateOutgoingDynamicStream(); 352 TestStream* stream2 = session_.CreateOutgoingDynamicStream();
360 QuicStreamId closed_stream_id = stream2->id(); 353 QuicStreamId closed_stream_id = stream2->id();
361 // Close the stream. 354 // Close the stream.
362 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _)); 355 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _));
363 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); 356 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 // should trigger a connection close. However there is no need to send 615 // should trigger a connection close. However there is no need to send
623 // multiple connection close frames. 616 // multiple connection close frames.
624 617
625 // Create valid stream. 618 // Create valid stream.
626 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT")); 619 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT"));
627 session_.OnStreamFrame(data1); 620 session_.OnStreamFrame(data1);
628 EXPECT_EQ(1u, session_.GetNumOpenStreams()); 621 EXPECT_EQ(1u, session_.GetNumOpenStreams());
629 622
630 // Process first invalid stream reset, resulting in the connection being 623 // Process first invalid stream reset, resulting in the connection being
631 // closed. 624 // closed.
632 EXPECT_CALL(*connection_, SendConnectionClose(FLAGS_exact_stream_id_delta 625 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS))
633 ? QUIC_TOO_MANY_OPEN_STREAMS
634 : QUIC_INVALID_STREAM_ID))
635 .Times(1); 626 .Times(1);
636 const QuicStreamId kLargeInvalidStreamId = 99999999; 627 const QuicStreamId kLargeInvalidStreamId = 99999999;
637 QuicRstStreamFrame rst1(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0); 628 QuicRstStreamFrame rst1(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0);
638 session_.OnRstStream(rst1); 629 session_.OnRstStream(rst1);
639 QuicConnectionPeer::CloseConnection(connection_); 630 QuicConnectionPeer::CloseConnection(connection_);
640 631
641 // Processing of second invalid stream reset should not result in the 632 // Processing of second invalid stream reset should not result in the
642 // connection being closed for a second time. 633 // connection being closed for a second time.
643 QuicRstStreamFrame rst2(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0); 634 QuicRstStreamFrame rst2(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0);
644 session_.OnRstStream(rst2); 635 session_.OnRstStream(rst2);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 EXPECT_TRUE(QuicSessionPeer::IsStreamImplicitlyCreated(&session_, 4)); 1023 EXPECT_TRUE(QuicSessionPeer::IsStreamImplicitlyCreated(&session_, 4));
1033 ASSERT_TRUE(session_.GetIncomingDynamicStream(2) != nullptr); 1024 ASSERT_TRUE(session_.GetIncomingDynamicStream(2) != nullptr);
1034 ASSERT_TRUE(session_.GetIncomingDynamicStream(4) != nullptr); 1025 ASSERT_TRUE(session_.GetIncomingDynamicStream(4) != nullptr);
1035 // And 5 should be not implicitly created. 1026 // And 5 should be not implicitly created.
1036 EXPECT_FALSE(QuicSessionPeer::IsStreamImplicitlyCreated(&session_, 5)); 1027 EXPECT_FALSE(QuicSessionPeer::IsStreamImplicitlyCreated(&session_, 5));
1037 } 1028 }
1038 1029
1039 } // namespace 1030 } // namespace
1040 } // namespace test 1031 } // namespace test
1041 } // namespace net 1032 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698