| OLD | NEW |
| 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/core/quic_session.h" | 5 #include "net/quic/core/quic_session.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 class TestSession : public QuicSpdySession { | 113 class TestSession : public QuicSpdySession { |
| 114 public: | 114 public: |
| 115 explicit TestSession(QuicConnection* connection) | 115 explicit TestSession(QuicConnection* connection) |
| 116 : QuicSpdySession(connection, DefaultQuicConfig()), | 116 : QuicSpdySession(connection, DefaultQuicConfig()), |
| 117 crypto_stream_(this), | 117 crypto_stream_(this), |
| 118 writev_consumes_all_data_(false) { | 118 writev_consumes_all_data_(false) { |
| 119 Initialize(); | 119 Initialize(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 ~TestSession() override { delete connection(); } |
| 123 |
| 122 TestCryptoStream* GetCryptoStream() override { return &crypto_stream_; } | 124 TestCryptoStream* GetCryptoStream() override { return &crypto_stream_; } |
| 123 | 125 |
| 124 TestStream* CreateOutgoingDynamicStream(SpdyPriority priority) override { | 126 TestStream* CreateOutgoingDynamicStream(SpdyPriority priority) override { |
| 125 TestStream* stream = new TestStream(GetNextOutgoingStreamId(), this); | 127 TestStream* stream = new TestStream(GetNextOutgoingStreamId(), this); |
| 126 stream->SetPriority(priority); | 128 stream->SetPriority(priority); |
| 127 ActivateStream(stream); | 129 ActivateStream(stream); |
| 128 return stream; | 130 return stream; |
| 129 } | 131 } |
| 130 | 132 |
| 131 TestStream* CreateIncomingDynamicStream(QuicStreamId id) override { | 133 TestStream* CreateIncomingDynamicStream(QuicStreamId id) override { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 SpdyHeaderBlock headers_; | 275 SpdyHeaderBlock headers_; |
| 274 }; | 276 }; |
| 275 | 277 |
| 276 class QuicSessionTestServer : public QuicSessionTestBase { | 278 class QuicSessionTestServer : public QuicSessionTestBase { |
| 277 protected: | 279 protected: |
| 278 QuicSessionTestServer() : QuicSessionTestBase(Perspective::IS_SERVER) {} | 280 QuicSessionTestServer() : QuicSessionTestBase(Perspective::IS_SERVER) {} |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 INSTANTIATE_TEST_CASE_P(Tests, | 283 INSTANTIATE_TEST_CASE_P(Tests, |
| 282 QuicSessionTestServer, | 284 QuicSessionTestServer, |
| 283 ::testing::ValuesIn(QuicSupportedVersions())); | 285 ::testing::ValuesIn(AllSupportedVersions())); |
| 284 | 286 |
| 285 TEST_P(QuicSessionTestServer, PeerAddress) { | 287 TEST_P(QuicSessionTestServer, PeerAddress) { |
| 286 EXPECT_EQ(IPEndPoint(Loopback4(), kTestPort), session_.peer_address()); | 288 EXPECT_EQ(IPEndPoint(Loopback4(), kTestPort), session_.peer_address()); |
| 287 } | 289 } |
| 288 | 290 |
| 289 TEST_P(QuicSessionTestServer, IsCryptoHandshakeConfirmed) { | 291 TEST_P(QuicSessionTestServer, IsCryptoHandshakeConfirmed) { |
| 290 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); | 292 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); |
| 291 CryptoHandshakeMessage message; | 293 CryptoHandshakeMessage message; |
| 292 session_.GetCryptoStream()->OnHandshakeMessage(message); | 294 session_.GetCryptoStream()->OnHandshakeMessage(message); |
| 293 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); | 295 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 EXPECT_CALL(*stream2, OnCanWrite()) | 485 EXPECT_CALL(*stream2, OnCanWrite()) |
| 484 .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( | 486 .WillOnce(DoAll(testing::IgnoreResult(Invoke(CreateFunctor( |
| 485 &TestSession::SendLargeFakeData, | 487 &TestSession::SendLargeFakeData, |
| 486 base::Unretained(&session_), stream2, 6000))), | 488 base::Unretained(&session_), stream2, 6000))), |
| 487 Invoke(&stream2_blocker, | 489 Invoke(&stream2_blocker, |
| 488 &StreamBlocker::MarkConnectionLevelWriteBlocked))); | 490 &StreamBlocker::MarkConnectionLevelWriteBlocked))); |
| 489 session_.OnCanWrite(); | 491 session_.OnCanWrite(); |
| 490 } | 492 } |
| 491 | 493 |
| 492 TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) { | 494 TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) { |
| 495 FLAGS_quic_enable_app_limited_check = true; |
| 496 |
| 493 // Encryption needs to be established before data can be sent. | 497 // Encryption needs to be established before data can be sent. |
| 494 CryptoHandshakeMessage msg; | 498 CryptoHandshakeMessage msg; |
| 495 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 499 session_.GetCryptoStream()->OnHandshakeMessage(msg); |
| 496 | 500 |
| 497 // Drive congestion control manually. | 501 // Drive congestion control manually. |
| 498 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; | 502 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
| 499 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, | 503 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, |
| 500 send_algorithm); | 504 send_algorithm); |
| 501 | 505 |
| 502 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 506 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 503 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 507 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 504 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 508 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 505 | 509 |
| 506 session_.MarkConnectionLevelWriteBlocked(stream2->id()); | 510 session_.MarkConnectionLevelWriteBlocked(stream2->id()); |
| 507 session_.MarkConnectionLevelWriteBlocked(stream6->id()); | 511 session_.MarkConnectionLevelWriteBlocked(stream6->id()); |
| 508 session_.MarkConnectionLevelWriteBlocked(stream4->id()); | 512 session_.MarkConnectionLevelWriteBlocked(stream4->id()); |
| 509 | 513 |
| 510 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) | 514 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
| 511 .WillRepeatedly(Return(QuicTime::Delta::Zero())); | 515 .WillRepeatedly(Return(QuicTime::Delta::Zero())); |
| 512 EXPECT_CALL(*send_algorithm, GetCongestionWindow()) | 516 EXPECT_CALL(*send_algorithm, GetCongestionWindow()) |
| 513 .WillRepeatedly(Return(kMaxPacketSize * 10)); | 517 .WillRepeatedly(Return(kMaxPacketSize * 10)); |
| 518 EXPECT_CALL(*send_algorithm, InRecovery()).WillRepeatedly(Return(false)); |
| 514 EXPECT_CALL(*stream2, OnCanWrite()) | 519 EXPECT_CALL(*stream2, OnCanWrite()) |
| 515 .WillOnce(testing::IgnoreResult( | 520 .WillOnce(testing::IgnoreResult( |
| 516 Invoke(CreateFunctor(&TestSession::SendStreamData, | 521 Invoke(CreateFunctor(&TestSession::SendStreamData, |
| 517 base::Unretained(&session_), stream2)))); | 522 base::Unretained(&session_), stream2)))); |
| 518 EXPECT_CALL(*stream4, OnCanWrite()) | 523 EXPECT_CALL(*stream4, OnCanWrite()) |
| 519 .WillOnce(testing::IgnoreResult( | 524 .WillOnce(testing::IgnoreResult( |
| 520 Invoke(CreateFunctor(&TestSession::SendStreamData, | 525 Invoke(CreateFunctor(&TestSession::SendStreamData, |
| 521 base::Unretained(&session_), stream4)))); | 526 base::Unretained(&session_), stream4)))); |
| 522 EXPECT_CALL(*stream6, OnCanWrite()) | 527 EXPECT_CALL(*stream6, OnCanWrite()) |
| 523 .WillOnce(testing::IgnoreResult( | 528 .WillOnce(testing::IgnoreResult( |
| 524 Invoke(CreateFunctor(&TestSession::SendStreamData, | 529 Invoke(CreateFunctor(&TestSession::SendStreamData, |
| 525 base::Unretained(&session_), stream6)))); | 530 base::Unretained(&session_), stream6)))); |
| 526 | 531 |
| 527 // Expect that we only send one packet, the writes from different streams | 532 // Expect that we only send one packet, the writes from different streams |
| 528 // should be bundled together. | 533 // should be bundled together. |
| 529 MockPacketWriter* writer = static_cast<MockPacketWriter*>( | 534 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
| 530 QuicConnectionPeer::GetWriter(session_.connection())); | 535 QuicConnectionPeer::GetWriter(session_.connection())); |
| 531 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) | 536 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) |
| 532 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); | 537 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
| 533 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _, _)); | 538 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _, _)); |
| 539 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); |
| 534 session_.OnCanWrite(); | 540 session_.OnCanWrite(); |
| 535 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 541 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
| 536 } | 542 } |
| 537 | 543 |
| 538 TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) { | 544 TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) { |
| 545 FLAGS_quic_enable_app_limited_check = true; |
| 546 |
| 539 InSequence s; | 547 InSequence s; |
| 540 | 548 |
| 541 // Drive congestion control manually. | 549 // Drive congestion control manually. |
| 542 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; | 550 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
| 543 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, | 551 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, |
| 544 send_algorithm); | 552 send_algorithm); |
| 545 | 553 |
| 546 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 554 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 547 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 555 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 548 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 556 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 569 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) | 577 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
| 570 .WillOnce(Return(QuicTime::Delta::Infinite())); | 578 .WillOnce(Return(QuicTime::Delta::Infinite())); |
| 571 session_.OnCanWrite(); | 579 session_.OnCanWrite(); |
| 572 EXPECT_TRUE(session_.WillingAndAbleToWrite()); | 580 EXPECT_TRUE(session_.WillingAndAbleToWrite()); |
| 573 | 581 |
| 574 // stream4->OnCanWrite is called once the connection stops being | 582 // stream4->OnCanWrite is called once the connection stops being |
| 575 // congestion-control blocked. | 583 // congestion-control blocked. |
| 576 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) | 584 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
| 577 .WillOnce(Return(QuicTime::Delta::Zero())); | 585 .WillOnce(Return(QuicTime::Delta::Zero())); |
| 578 EXPECT_CALL(*stream4, OnCanWrite()); | 586 EXPECT_CALL(*stream4, OnCanWrite()); |
| 587 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); |
| 579 session_.OnCanWrite(); | 588 session_.OnCanWrite(); |
| 580 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 589 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
| 581 } | 590 } |
| 582 | 591 |
| 592 TEST_P(QuicSessionTestServer, OnCanWriteWriterBlocks) { |
| 593 FLAGS_quic_enable_app_limited_check = true; |
| 594 |
| 595 // Drive congestion control manually in order to ensure that |
| 596 // application-limited signaling is handled correctly. |
| 597 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
| 598 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, |
| 599 send_algorithm); |
| 600 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
| 601 .WillRepeatedly(Return(QuicTime::Delta::Zero())); |
| 602 |
| 603 // Drive packet writer manually. |
| 604 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
| 605 QuicConnectionPeer::GetWriter(session_.connection())); |
| 606 EXPECT_CALL(*writer, IsWriteBlocked()).WillRepeatedly(Return(true)); |
| 607 EXPECT_CALL(*writer, IsWriteBlockedDataBuffered()) |
| 608 .WillRepeatedly(Return(true)); |
| 609 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)).Times(0); |
| 610 |
| 611 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 612 |
| 613 session_.MarkConnectionLevelWriteBlocked(stream2->id()); |
| 614 |
| 615 EXPECT_CALL(*stream2, OnCanWrite()).Times(0); |
| 616 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)).Times(0); |
| 617 |
| 618 session_.OnCanWrite(); |
| 619 EXPECT_TRUE(session_.WillingAndAbleToWrite()); |
| 620 } |
| 621 |
| 583 TEST_P(QuicSessionTestServer, BufferedHandshake) { | 622 TEST_P(QuicSessionTestServer, BufferedHandshake) { |
| 584 EXPECT_FALSE(session_.HasPendingHandshake()); // Default value. | 623 EXPECT_FALSE(session_.HasPendingHandshake()); // Default value. |
| 585 | 624 |
| 586 // Test that blocking other streams does not change our status. | 625 // Test that blocking other streams does not change our status. |
| 587 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 626 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 588 StreamBlocker stream2_blocker(&session_, stream2->id()); | 627 StreamBlocker stream2_blocker(&session_, stream2->id()); |
| 589 stream2_blocker.MarkConnectionLevelWriteBlocked(); | 628 stream2_blocker.MarkConnectionLevelWriteBlocked(); |
| 590 EXPECT_FALSE(session_.HasPendingHandshake()); | 629 EXPECT_FALSE(session_.HasPendingHandshake()); |
| 591 | 630 |
| 592 TestStream* stream3 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 631 TestStream* stream3 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 CloseStream(stream6->id()); | 674 CloseStream(stream6->id()); |
| 636 | 675 |
| 637 InSequence s; | 676 InSequence s; |
| 638 EXPECT_CALL(*stream2, OnCanWrite()); | 677 EXPECT_CALL(*stream2, OnCanWrite()); |
| 639 EXPECT_CALL(*stream4, OnCanWrite()); | 678 EXPECT_CALL(*stream4, OnCanWrite()); |
| 640 session_.OnCanWrite(); | 679 session_.OnCanWrite(); |
| 641 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 680 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
| 642 } | 681 } |
| 643 | 682 |
| 644 TEST_P(QuicSessionTestServer, OnCanWriteLimitsNumWritesIfFlowControlBlocked) { | 683 TEST_P(QuicSessionTestServer, OnCanWriteLimitsNumWritesIfFlowControlBlocked) { |
| 684 FLAGS_quic_enable_app_limited_check = true; |
| 685 |
| 686 // Drive congestion control manually in order to ensure that |
| 687 // application-limited signaling is handled correctly. |
| 688 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
| 689 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), kDefaultPathId, |
| 690 send_algorithm); |
| 691 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
| 692 .WillRepeatedly(Return(QuicTime::Delta::Zero())); |
| 693 |
| 645 // Ensure connection level flow control blockage. | 694 // Ensure connection level flow control blockage. |
| 646 QuicFlowControllerPeer::SetSendWindowOffset(session_.flow_controller(), 0); | 695 QuicFlowControllerPeer::SetSendWindowOffset(session_.flow_controller(), 0); |
| 647 EXPECT_TRUE(session_.flow_controller()->IsBlocked()); | 696 EXPECT_TRUE(session_.flow_controller()->IsBlocked()); |
| 648 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked()); | 697 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked()); |
| 649 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 698 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 650 | 699 |
| 651 // Mark the crypto and headers streams as write blocked, we expect them to be | 700 // Mark the crypto and headers streams as write blocked, we expect them to be |
| 652 // allowed to write later. | 701 // allowed to write later. |
| 653 session_.MarkConnectionLevelWriteBlocked(kCryptoStreamId); | 702 session_.MarkConnectionLevelWriteBlocked(kCryptoStreamId); |
| 654 session_.MarkConnectionLevelWriteBlocked(kHeadersStreamId); | 703 session_.MarkConnectionLevelWriteBlocked(kHeadersStreamId); |
| 655 | 704 |
| 656 // Create a data stream, and although it is write blocked we never expect it | 705 // Create a data stream, and although it is write blocked we never expect it |
| 657 // to be allowed to write as we are connection level flow control blocked. | 706 // to be allowed to write as we are connection level flow control blocked. |
| 658 TestStream* stream = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 707 TestStream* stream = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 659 session_.MarkConnectionLevelWriteBlocked(stream->id()); | 708 session_.MarkConnectionLevelWriteBlocked(stream->id()); |
| 660 EXPECT_CALL(*stream, OnCanWrite()).Times(0); | 709 EXPECT_CALL(*stream, OnCanWrite()).Times(0); |
| 661 | 710 |
| 662 // The crypto and headers streams should be called even though we are | 711 // The crypto and headers streams should be called even though we are |
| 663 // connection flow control blocked. | 712 // connection flow control blocked. |
| 664 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); | 713 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); |
| 665 EXPECT_CALL(*crypto_stream, OnCanWrite()); | 714 EXPECT_CALL(*crypto_stream, OnCanWrite()); |
| 666 TestHeadersStream* headers_stream = new TestHeadersStream(&session_); | 715 TestHeadersStream* headers_stream = new TestHeadersStream(&session_); |
| 667 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); | 716 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); |
| 668 EXPECT_CALL(*headers_stream, OnCanWrite()); | 717 EXPECT_CALL(*headers_stream, OnCanWrite()); |
| 669 | 718 |
| 719 // After the crypto and header streams perform a write, the connection will be |
| 720 // blocked by the flow control, hence it should become application-limited. |
| 721 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); |
| 722 |
| 670 session_.OnCanWrite(); | 723 session_.OnCanWrite(); |
| 671 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 724 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
| 672 } | 725 } |
| 673 | 726 |
| 674 TEST_P(QuicSessionTestServer, SendGoAway) { | 727 TEST_P(QuicSessionTestServer, SendGoAway) { |
| 675 MockPacketWriter* writer = static_cast<MockPacketWriter*>( | 728 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
| 676 QuicConnectionPeer::GetWriter(session_.connection())); | 729 QuicConnectionPeer::GetWriter(session_.connection())); |
| 677 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) | 730 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) |
| 678 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); | 731 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
| 679 EXPECT_CALL(*connection_, SendGoAway(_, _, _)) | 732 EXPECT_CALL(*connection_, SendGoAway(_, _, _)) |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1173 } |
| 1121 } | 1174 } |
| 1122 | 1175 |
| 1123 class QuicSessionTestClient : public QuicSessionTestBase { | 1176 class QuicSessionTestClient : public QuicSessionTestBase { |
| 1124 protected: | 1177 protected: |
| 1125 QuicSessionTestClient() : QuicSessionTestBase(Perspective::IS_CLIENT) {} | 1178 QuicSessionTestClient() : QuicSessionTestBase(Perspective::IS_CLIENT) {} |
| 1126 }; | 1179 }; |
| 1127 | 1180 |
| 1128 INSTANTIATE_TEST_CASE_P(Tests, | 1181 INSTANTIATE_TEST_CASE_P(Tests, |
| 1129 QuicSessionTestClient, | 1182 QuicSessionTestClient, |
| 1130 ::testing::ValuesIn(QuicSupportedVersions())); | 1183 ::testing::ValuesIn(AllSupportedVersions())); |
| 1131 | 1184 |
| 1132 TEST_P(QuicSessionTestClient, AvailableStreamsClient) { | 1185 TEST_P(QuicSessionTestClient, AvailableStreamsClient) { |
| 1133 ASSERT_TRUE(session_.GetOrCreateDynamicStream(6) != nullptr); | 1186 ASSERT_TRUE(session_.GetOrCreateDynamicStream(6) != nullptr); |
| 1134 // Both 2 and 4 should be available. | 1187 // Both 2 and 4 should be available. |
| 1135 EXPECT_TRUE(QuicSessionPeer::IsStreamAvailable(&session_, 2)); | 1188 EXPECT_TRUE(QuicSessionPeer::IsStreamAvailable(&session_, 2)); |
| 1136 EXPECT_TRUE(QuicSessionPeer::IsStreamAvailable(&session_, 4)); | 1189 EXPECT_TRUE(QuicSessionPeer::IsStreamAvailable(&session_, 4)); |
| 1137 ASSERT_TRUE(session_.GetOrCreateDynamicStream(2) != nullptr); | 1190 ASSERT_TRUE(session_.GetOrCreateDynamicStream(2) != nullptr); |
| 1138 ASSERT_TRUE(session_.GetOrCreateDynamicStream(4) != nullptr); | 1191 ASSERT_TRUE(session_.GetOrCreateDynamicStream(4) != nullptr); |
| 1139 // And 5 should be not available. | 1192 // And 5 should be not available. |
| 1140 EXPECT_FALSE(QuicSessionPeer::IsStreamAvailable(&session_, 5)); | 1193 EXPECT_FALSE(QuicSessionPeer::IsStreamAvailable(&session_, 5)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 if (version() <= QUIC_VERSION_35) { | 1254 if (version() <= QUIC_VERSION_35) { |
| 1202 EXPECT_FALSE(session_.force_hol_blocking()); | 1255 EXPECT_FALSE(session_.force_hol_blocking()); |
| 1203 } else { | 1256 } else { |
| 1204 EXPECT_TRUE(session_.force_hol_blocking()); | 1257 EXPECT_TRUE(session_.force_hol_blocking()); |
| 1205 } | 1258 } |
| 1206 } | 1259 } |
| 1207 | 1260 |
| 1208 } // namespace | 1261 } // namespace |
| 1209 } // namespace test | 1262 } // namespace test |
| 1210 } // namespace net | 1263 } // namespace net |
| OLD | NEW |