| 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 <cstdint> | 7 #include <cstdint> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 crypto_stream_(this), | 118 crypto_stream_(this), |
| 119 writev_consumes_all_data_(false) { | 119 writev_consumes_all_data_(false) { |
| 120 Initialize(); | 120 Initialize(); |
| 121 this->connection()->SetEncrypter( | 121 this->connection()->SetEncrypter( |
| 122 ENCRYPTION_FORWARD_SECURE, | 122 ENCRYPTION_FORWARD_SECURE, |
| 123 new NullEncrypter(connection->perspective())); | 123 new NullEncrypter(connection->perspective())); |
| 124 } | 124 } |
| 125 | 125 |
| 126 ~TestSession() override { delete connection(); } | 126 ~TestSession() override { delete connection(); } |
| 127 | 127 |
| 128 TestCryptoStream* GetCryptoStream() override { return &crypto_stream_; } | 128 TestCryptoStream* GetMutableCryptoStream() override { |
| 129 return &crypto_stream_; |
| 130 } |
| 131 |
| 132 const TestCryptoStream* GetCryptoStream() const override { |
| 133 return &crypto_stream_; |
| 134 } |
| 129 | 135 |
| 130 TestStream* CreateOutgoingDynamicStream(SpdyPriority priority) override { | 136 TestStream* CreateOutgoingDynamicStream(SpdyPriority priority) override { |
| 131 TestStream* stream = new TestStream(GetNextOutgoingStreamId(), this); | 137 TestStream* stream = new TestStream(GetNextOutgoingStreamId(), this); |
| 132 stream->SetPriority(priority); | 138 stream->SetPriority(priority); |
| 133 ActivateStream(QuicWrapUnique(stream)); | 139 ActivateStream(QuicWrapUnique(stream)); |
| 134 return stream; | 140 return stream; |
| 135 } | 141 } |
| 136 | 142 |
| 137 TestStream* CreateIncomingDynamicStream(QuicStreamId id) override { | 143 TestStream* CreateIncomingDynamicStream(QuicStreamId id) override { |
| 138 // Enforce the limit on the number of open streams. | 144 // Enforce the limit on the number of open streams. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 ::testing::ValuesIn(AllSupportedVersions())); | 303 ::testing::ValuesIn(AllSupportedVersions())); |
| 298 | 304 |
| 299 TEST_P(QuicSessionTestServer, PeerAddress) { | 305 TEST_P(QuicSessionTestServer, PeerAddress) { |
| 300 EXPECT_EQ(QuicSocketAddress(QuicIpAddress::Loopback4(), kTestPort), | 306 EXPECT_EQ(QuicSocketAddress(QuicIpAddress::Loopback4(), kTestPort), |
| 301 session_.peer_address()); | 307 session_.peer_address()); |
| 302 } | 308 } |
| 303 | 309 |
| 304 TEST_P(QuicSessionTestServer, IsCryptoHandshakeConfirmed) { | 310 TEST_P(QuicSessionTestServer, IsCryptoHandshakeConfirmed) { |
| 305 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); | 311 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); |
| 306 CryptoHandshakeMessage message; | 312 CryptoHandshakeMessage message; |
| 307 session_.GetCryptoStream()->OnHandshakeMessage(message); | 313 session_.GetMutableCryptoStream()->OnHandshakeMessage(message); |
| 308 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); | 314 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); |
| 309 } | 315 } |
| 310 | 316 |
| 311 TEST_P(QuicSessionTestServer, IsClosedStreamDefault) { | 317 TEST_P(QuicSessionTestServer, IsClosedStreamDefault) { |
| 312 // Ensure that no streams are initially closed. | 318 // Ensure that no streams are initially closed. |
| 313 for (QuicStreamId i = kCryptoStreamId; i < 100; i++) { | 319 for (QuicStreamId i = kCryptoStreamId; i < 100; i++) { |
| 314 EXPECT_FALSE(session_.IsClosedStream(i)) << "stream id: " << i; | 320 EXPECT_FALSE(session_.IsClosedStream(i)) << "stream id: " << i; |
| 315 } | 321 } |
| 316 } | 322 } |
| 317 | 323 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 524 |
| 519 TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) { | 525 TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) { |
| 520 // Encryption needs to be established before data can be sent. | 526 // Encryption needs to be established before data can be sent. |
| 521 CryptoHandshakeMessage msg; | 527 CryptoHandshakeMessage msg; |
| 522 MockPacketWriter* writer = static_cast<MockPacketWriter*>( | 528 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
| 523 QuicConnectionPeer::GetWriter(session_.connection())); | 529 QuicConnectionPeer::GetWriter(session_.connection())); |
| 524 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { | 530 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { |
| 525 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) | 531 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) |
| 526 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); | 532 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
| 527 } | 533 } |
| 528 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 534 session_.GetMutableCryptoStream()->OnHandshakeMessage(msg); |
| 529 | 535 |
| 530 // Drive congestion control manually. | 536 // Drive congestion control manually. |
| 531 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; | 537 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
| 532 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); | 538 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); |
| 533 | 539 |
| 534 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 540 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 535 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 541 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 536 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 542 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 537 | 543 |
| 538 session_.MarkConnectionLevelWriteBlocked(stream2->id()); | 544 session_.MarkConnectionLevelWriteBlocked(stream2->id()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 stream4_blocker.MarkConnectionLevelWriteBlocked(); | 679 stream4_blocker.MarkConnectionLevelWriteBlocked(); |
| 674 EXPECT_TRUE(session_.HasPendingHandshake()); | 680 EXPECT_TRUE(session_.HasPendingHandshake()); |
| 675 | 681 |
| 676 InSequence s; | 682 InSequence s; |
| 677 // Force most streams to re-register, which is common scenario when we block | 683 // Force most streams to re-register, which is common scenario when we block |
| 678 // the Crypto stream, and only the crypto stream can "really" write. | 684 // the Crypto stream, and only the crypto stream can "really" write. |
| 679 | 685 |
| 680 // Due to prioritization, we *should* be asked to write the crypto stream | 686 // Due to prioritization, we *should* be asked to write the crypto stream |
| 681 // first. | 687 // first. |
| 682 // Don't re-register the crypto stream (which signals complete writing). | 688 // Don't re-register the crypto stream (which signals complete writing). |
| 683 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); | 689 TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream(); |
| 684 EXPECT_CALL(*crypto_stream, OnCanWrite()); | 690 EXPECT_CALL(*crypto_stream, OnCanWrite()); |
| 685 | 691 |
| 686 EXPECT_CALL(*stream2, OnCanWrite()) | 692 EXPECT_CALL(*stream2, OnCanWrite()) |
| 687 .WillOnce(testing::IgnoreResult( | 693 .WillOnce(testing::IgnoreResult( |
| 688 Invoke(CreateFunctor(&TestSession::SendStreamData, | 694 Invoke(CreateFunctor(&TestSession::SendStreamData, |
| 689 base::Unretained(&session_), stream2)))); | 695 base::Unretained(&session_), stream2)))); |
| 690 EXPECT_CALL(*stream3, OnCanWrite()) | 696 EXPECT_CALL(*stream3, OnCanWrite()) |
| 691 .WillOnce(testing::IgnoreResult( | 697 .WillOnce(testing::IgnoreResult( |
| 692 Invoke(CreateFunctor(&TestSession::SendStreamData, | 698 Invoke(CreateFunctor(&TestSession::SendStreamData, |
| 693 base::Unretained(&session_), stream3)))); | 699 base::Unretained(&session_), stream3)))); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 session_.MarkConnectionLevelWriteBlocked(kHeadersStreamId); | 753 session_.MarkConnectionLevelWriteBlocked(kHeadersStreamId); |
| 748 | 754 |
| 749 // Create a data stream, and although it is write blocked we never expect it | 755 // Create a data stream, and although it is write blocked we never expect it |
| 750 // to be allowed to write as we are connection level flow control blocked. | 756 // to be allowed to write as we are connection level flow control blocked. |
| 751 TestStream* stream = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 757 TestStream* stream = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
| 752 session_.MarkConnectionLevelWriteBlocked(stream->id()); | 758 session_.MarkConnectionLevelWriteBlocked(stream->id()); |
| 753 EXPECT_CALL(*stream, OnCanWrite()).Times(0); | 759 EXPECT_CALL(*stream, OnCanWrite()).Times(0); |
| 754 | 760 |
| 755 // The crypto and headers streams should be called even though we are | 761 // The crypto and headers streams should be called even though we are |
| 756 // connection flow control blocked. | 762 // connection flow control blocked. |
| 757 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); | 763 TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream(); |
| 758 EXPECT_CALL(*crypto_stream, OnCanWrite()); | 764 EXPECT_CALL(*crypto_stream, OnCanWrite()); |
| 759 TestHeadersStream* headers_stream = new TestHeadersStream(&session_); | 765 TestHeadersStream* headers_stream = new TestHeadersStream(&session_); |
| 760 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); | 766 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); |
| 761 EXPECT_CALL(*headers_stream, OnCanWrite()); | 767 EXPECT_CALL(*headers_stream, OnCanWrite()); |
| 762 | 768 |
| 763 // After the crypto and header streams perform a write, the connection will be | 769 // After the crypto and header streams perform a write, the connection will be |
| 764 // blocked by the flow control, hence it should become application-limited. | 770 // blocked by the flow control, hence it should become application-limited. |
| 765 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); | 771 EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); |
| 766 | 772 |
| 767 session_.OnCanWrite(); | 773 session_.OnCanWrite(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 782 EXPECT_CALL(*connection_, | 788 EXPECT_CALL(*connection_, |
| 783 SendRstStream(kTestStreamId, QUIC_STREAM_PEER_GOING_AWAY, 0)) | 789 SendRstStream(kTestStreamId, QUIC_STREAM_PEER_GOING_AWAY, 0)) |
| 784 .Times(0); | 790 .Times(0); |
| 785 EXPECT_TRUE(session_.GetOrCreateDynamicStream(kTestStreamId)); | 791 EXPECT_TRUE(session_.GetOrCreateDynamicStream(kTestStreamId)); |
| 786 } | 792 } |
| 787 | 793 |
| 788 TEST_P(QuicSessionTestServer, IncreasedTimeoutAfterCryptoHandshake) { | 794 TEST_P(QuicSessionTestServer, IncreasedTimeoutAfterCryptoHandshake) { |
| 789 EXPECT_EQ(kInitialIdleTimeoutSecs + 3, | 795 EXPECT_EQ(kInitialIdleTimeoutSecs + 3, |
| 790 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); | 796 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); |
| 791 CryptoHandshakeMessage msg; | 797 CryptoHandshakeMessage msg; |
| 792 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 798 session_.GetMutableCryptoStream()->OnHandshakeMessage(msg); |
| 793 EXPECT_EQ(kMaximumIdleTimeoutSecs + 3, | 799 EXPECT_EQ(kMaximumIdleTimeoutSecs + 3, |
| 794 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); | 800 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); |
| 795 } | 801 } |
| 796 | 802 |
| 797 TEST_P(QuicSessionTestServer, RstStreamBeforeHeadersDecompressed) { | 803 TEST_P(QuicSessionTestServer, RstStreamBeforeHeadersDecompressed) { |
| 798 // Send two bytes of payload. | 804 // Send two bytes of payload. |
| 799 QuicStreamFrame data1(kClientDataStreamId1, false, 0, QuicStringPiece("HT")); | 805 QuicStreamFrame data1(kClientDataStreamId1, false, 0, QuicStringPiece("HT")); |
| 800 session_.OnStreamFrame(data1); | 806 session_.OnStreamFrame(data1); |
| 801 EXPECT_EQ(1u, session_.GetNumOpenIncomingStreams()); | 807 EXPECT_EQ(1u, session_.GetNumOpenIncomingStreams()); |
| 802 | 808 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 829 EXPECT_TRUE(stream2->flow_controller()->IsBlocked()); | 835 EXPECT_TRUE(stream2->flow_controller()->IsBlocked()); |
| 830 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked()); | 836 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked()); |
| 831 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); | 837 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); |
| 832 | 838 |
| 833 // The handshake message will call OnCanWrite, so the stream can resume | 839 // The handshake message will call OnCanWrite, so the stream can resume |
| 834 // writing. | 840 // writing. |
| 835 EXPECT_CALL(*stream2, OnCanWrite()); | 841 EXPECT_CALL(*stream2, OnCanWrite()); |
| 836 // Now complete the crypto handshake, resulting in an increased flow control | 842 // Now complete the crypto handshake, resulting in an increased flow control |
| 837 // send window. | 843 // send window. |
| 838 CryptoHandshakeMessage msg; | 844 CryptoHandshakeMessage msg; |
| 839 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 845 session_.GetMutableCryptoStream()->OnHandshakeMessage(msg); |
| 840 | 846 |
| 841 // Stream is now unblocked. | 847 // Stream is now unblocked. |
| 842 EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); | 848 EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); |
| 843 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 849 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 844 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 850 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 845 } | 851 } |
| 846 | 852 |
| 847 TEST_P(QuicSessionTestServer, HandshakeUnblocksFlowControlBlockedCryptoStream) { | 853 TEST_P(QuicSessionTestServer, HandshakeUnblocksFlowControlBlockedCryptoStream) { |
| 848 // Test that if the crypto stream is flow control blocked, then if the SHLO | 854 // Test that if the crypto stream is flow control blocked, then if the SHLO |
| 849 // contains a larger send window offset, the stream becomes unblocked. | 855 // contains a larger send window offset, the stream becomes unblocked. |
| 850 session_.set_writev_consumes_all_data(true); | 856 session_.set_writev_consumes_all_data(true); |
| 851 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); | 857 TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream(); |
| 852 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 858 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
| 853 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 859 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 854 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 860 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 855 QuicHeadersStream* headers_stream = | 861 QuicHeadersStream* headers_stream = |
| 856 QuicSpdySessionPeer::GetHeadersStream(&session_); | 862 QuicSpdySessionPeer::GetHeadersStream(&session_); |
| 857 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); | 863 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); |
| 858 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 864 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 859 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 865 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 860 // Write until the crypto stream is flow control blocked. | 866 // Write until the crypto stream is flow control blocked. |
| 861 EXPECT_CALL(*connection_, SendBlocked(kCryptoStreamId)); | 867 EXPECT_CALL(*connection_, SendBlocked(kCryptoStreamId)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 874 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); | 880 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); |
| 875 EXPECT_FALSE(session_.HasDataToWrite()); | 881 EXPECT_FALSE(session_.HasDataToWrite()); |
| 876 EXPECT_TRUE(crypto_stream->HasBufferedData()); | 882 EXPECT_TRUE(crypto_stream->HasBufferedData()); |
| 877 | 883 |
| 878 // The handshake message will call OnCanWrite, so the stream can | 884 // The handshake message will call OnCanWrite, so the stream can |
| 879 // resume writing. | 885 // resume writing. |
| 880 EXPECT_CALL(*crypto_stream, OnCanWrite()); | 886 EXPECT_CALL(*crypto_stream, OnCanWrite()); |
| 881 // Now complete the crypto handshake, resulting in an increased flow control | 887 // Now complete the crypto handshake, resulting in an increased flow control |
| 882 // send window. | 888 // send window. |
| 883 CryptoHandshakeMessage msg; | 889 CryptoHandshakeMessage msg; |
| 884 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 890 session_.GetMutableCryptoStream()->OnHandshakeMessage(msg); |
| 885 | 891 |
| 886 // Stream is now unblocked and will no longer have buffered data. | 892 // Stream is now unblocked and will no longer have buffered data. |
| 887 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 893 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
| 888 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 894 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 889 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 895 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 890 } | 896 } |
| 891 | 897 |
| 892 #if !defined(OS_IOS) | 898 #if !defined(OS_IOS) |
| 893 // This test is failing flakily for iOS bots. | 899 // This test is failing flakily for iOS bots. |
| 894 // http://crbug.com/425050 | 900 // http://crbug.com/425050 |
| 895 // NOTE: It's not possible to use the standard MAYBE_ convention to disable | 901 // NOTE: It's not possible to use the standard MAYBE_ convention to disable |
| 896 // this test on iOS because when this test gets instantiated it ends up with | 902 // this test on iOS because when this test gets instantiated it ends up with |
| 897 // various names that are dependent on the parameters passed. | 903 // various names that are dependent on the parameters passed. |
| 898 TEST_P(QuicSessionTestServer, | 904 TEST_P(QuicSessionTestServer, |
| 899 HandshakeUnblocksFlowControlBlockedHeadersStream) { | 905 HandshakeUnblocksFlowControlBlockedHeadersStream) { |
| 900 // Test that if the header stream is flow control blocked, then if the SHLO | 906 // Test that if the header stream is flow control blocked, then if the SHLO |
| 901 // contains a larger send window offset, the stream becomes unblocked. | 907 // contains a larger send window offset, the stream becomes unblocked. |
| 902 session_.set_writev_consumes_all_data(true); | 908 session_.set_writev_consumes_all_data(true); |
| 903 TestCryptoStream* crypto_stream = session_.GetCryptoStream(); | 909 TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream(); |
| 904 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 910 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
| 905 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 911 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 906 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 912 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 907 QuicHeadersStream* headers_stream = | 913 QuicHeadersStream* headers_stream = |
| 908 QuicSpdySessionPeer::GetHeadersStream(&session_); | 914 QuicSpdySessionPeer::GetHeadersStream(&session_); |
| 909 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); | 915 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); |
| 910 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 916 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 911 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 917 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 912 QuicStreamId stream_id = 5; | 918 QuicStreamId stream_id = 5; |
| 913 // Write until the header stream is flow control blocked. | 919 // Write until the header stream is flow control blocked. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 928 | 934 |
| 929 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); | 935 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); |
| 930 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 936 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
| 931 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 937 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 932 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); | 938 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); |
| 933 EXPECT_FALSE(session_.HasDataToWrite()); | 939 EXPECT_FALSE(session_.HasDataToWrite()); |
| 934 | 940 |
| 935 // Now complete the crypto handshake, resulting in an increased flow control | 941 // Now complete the crypto handshake, resulting in an increased flow control |
| 936 // send window. | 942 // send window. |
| 937 CryptoHandshakeMessage msg; | 943 CryptoHandshakeMessage msg; |
| 938 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 944 session_.GetMutableCryptoStream()->OnHandshakeMessage(msg); |
| 939 | 945 |
| 940 // Stream is now unblocked and will no longer have buffered data. | 946 // Stream is now unblocked and will no longer have buffered data. |
| 941 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); | 947 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); |
| 942 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 948 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
| 943 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 949 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
| 944 EXPECT_FALSE(headers_stream->HasBufferedData()); | 950 EXPECT_FALSE(headers_stream->HasBufferedData()); |
| 945 } | 951 } |
| 946 #endif // !defined(OS_IOS) | 952 #endif // !defined(OS_IOS) |
| 947 | 953 |
| 948 TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingRstOutOfOrder) { | 954 TEST_P(QuicSessionTestServer, ConnectionFlowControlAccountingRstOutOfOrder) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 if (version() != QUIC_VERSION_36) { | 1314 if (version() != QUIC_VERSION_36) { |
| 1309 EXPECT_FALSE(session_.force_hol_blocking()); | 1315 EXPECT_FALSE(session_.force_hol_blocking()); |
| 1310 } else { | 1316 } else { |
| 1311 EXPECT_TRUE(session_.force_hol_blocking()); | 1317 EXPECT_TRUE(session_.force_hol_blocking()); |
| 1312 } | 1318 } |
| 1313 } | 1319 } |
| 1314 | 1320 |
| 1315 } // namespace | 1321 } // namespace |
| 1316 } // namespace test | 1322 } // namespace test |
| 1317 } // namespace net | 1323 } // namespace net |
| OLD | NEW |