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/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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 TEST_P(QuicSessionTest, StreamIdTooLarge) { | 310 TEST_P(QuicSessionTest, StreamIdTooLarge) { |
311 QuicStreamId stream_id = kClientDataStreamId1; | 311 QuicStreamId stream_id = kClientDataStreamId1; |
312 session_.GetIncomingDataStream(stream_id); | 312 session_.GetIncomingDataStream(stream_id); |
313 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); | 313 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); |
314 session_.GetIncomingDataStream(stream_id + kMaxStreamIdDelta + 2); | 314 session_.GetIncomingDataStream(stream_id + kMaxStreamIdDelta + 2); |
315 } | 315 } |
316 | 316 |
317 TEST_P(QuicSessionTest, DecompressionError) { | 317 TEST_P(QuicSessionTest, DecompressionError) { |
318 QuicHeadersStream* stream = QuicSessionPeer::GetHeadersStream(&session_); | 318 QuicHeadersStream* stream = QuicSessionPeer::GetHeadersStream(&session_); |
| 319 if (version() > QUIC_VERSION_23) { |
| 320 // This test does not apply to HPACK compression. |
| 321 return; |
| 322 } |
319 const unsigned char data[] = { | 323 const unsigned char data[] = { |
320 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame | 324 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame |
321 0x00, 0x00, 0x00, 0x25, // flags/length | 325 0x00, 0x00, 0x00, 0x25, // flags/length |
322 0x00, 0x00, 0x00, 0x05, // stream id | 326 0x00, 0x00, 0x00, 0x05, // stream id |
323 0x00, 0x00, 0x00, 0x00, // associated stream id | 327 0x00, 0x00, 0x00, 0x00, // associated stream id |
324 0x00, 0x00, | 328 0x00, 0x00, |
325 'a', 'b', 'c', 'd' // invalid compressed data | 329 'a', 'b', 'c', 'd' // invalid compressed data |
326 }; | 330 }; |
327 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( | 331 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( |
328 QUIC_INVALID_HEADERS_STREAM_DATA, | 332 QUIC_INVALID_HEADERS_STREAM_DATA, |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 720 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
717 QuicStreamId stream_id = 5; | 721 QuicStreamId stream_id = 5; |
718 // Write until the header stream is flow control blocked. | 722 // Write until the header stream is flow control blocked. |
719 SpdyHeaderBlock headers; | 723 SpdyHeaderBlock headers; |
720 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { | 724 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { |
721 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 725 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
722 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 726 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
723 headers["header"] = base::Uint64ToString(base::RandUint64()) + | 727 headers["header"] = base::Uint64ToString(base::RandUint64()) + |
724 base::Uint64ToString(base::RandUint64()) + | 728 base::Uint64ToString(base::RandUint64()) + |
725 base::Uint64ToString(base::RandUint64()); | 729 base::Uint64ToString(base::RandUint64()); |
726 headers_stream->WriteHeaders(stream_id, headers, true, nullptr); | 730 headers_stream->WriteHeaders(stream_id, headers, true, 0, nullptr); |
727 stream_id += 2; | 731 stream_id += 2; |
728 } | 732 } |
729 // Write once more to ensure that the headers stream has buffered data. The | 733 // Write once more to ensure that the headers stream has buffered data. The |
730 // random headers may have exactly filled the flow control window. | 734 // random headers may have exactly filled the flow control window. |
731 headers_stream->WriteHeaders(stream_id, headers, true, nullptr); | 735 headers_stream->WriteHeaders(stream_id, headers, true, 0, nullptr); |
732 EXPECT_TRUE(headers_stream->HasBufferedData()); | 736 EXPECT_TRUE(headers_stream->HasBufferedData()); |
733 | 737 |
734 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); | 738 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); |
735 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 739 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
736 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 740 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
737 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); | 741 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); |
738 EXPECT_FALSE(session_.HasDataToWrite()); | 742 EXPECT_FALSE(session_.HasDataToWrite()); |
739 | 743 |
740 // Now complete the crypto handshake, resulting in an increased flow control | 744 // Now complete the crypto handshake, resulting in an increased flow control |
741 // send window. | 745 // send window. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 } | 967 } |
964 | 968 |
965 // Called after any new data is received by the session, and triggers the call | 969 // Called after any new data is received by the session, and triggers the call |
966 // to close the connection. | 970 // to close the connection. |
967 session_.PostProcessAfterData(); | 971 session_.PostProcessAfterData(); |
968 } | 972 } |
969 | 973 |
970 } // namespace | 974 } // namespace |
971 } // namespace test | 975 } // namespace test |
972 } // namespace net | 976 } // namespace net |
OLD | NEW |