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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 EXPECT_CALL(*stream4, OnCanWrite()); | 439 EXPECT_CALL(*stream4, OnCanWrite()); |
440 session_.OnCanWrite(); | 440 session_.OnCanWrite(); |
441 EXPECT_FALSE(session_.HasPendingWrites()); | 441 EXPECT_FALSE(session_.HasPendingWrites()); |
442 } | 442 } |
443 | 443 |
444 // Regression test for http://crbug.com/248737 | 444 // Regression test for http://crbug.com/248737 |
445 TEST_P(QuicSessionTest, OutOfOrderHeaders) { | 445 TEST_P(QuicSessionTest, OutOfOrderHeaders) { |
446 QuicSpdyCompressor compressor; | 446 QuicSpdyCompressor compressor; |
447 vector<QuicStreamFrame> frames; | 447 vector<QuicStreamFrame> frames; |
448 QuicPacketHeader header; | 448 QuicPacketHeader header; |
449 header.public_header.guid = session_.guid(); | 449 header.public_header.connection_id = session_.connection_id(); |
450 | 450 |
451 TestStream* stream2 = session_.CreateOutgoingDataStream(); | 451 TestStream* stream2 = session_.CreateOutgoingDataStream(); |
452 TestStream* stream4 = session_.CreateOutgoingDataStream(); | 452 TestStream* stream4 = session_.CreateOutgoingDataStream(); |
453 stream2->CloseWriteSide(); | 453 stream2->CloseWriteSide(); |
454 stream4->CloseWriteSide(); | 454 stream4->CloseWriteSide(); |
455 | 455 |
456 // Create frame with headers for stream2. | 456 // Create frame with headers for stream2. |
457 string compressed_headers1 = compressor.CompressHeaders(headers_); | 457 string compressed_headers1 = compressor.CompressHeaders(headers_); |
458 QuicStreamFrame frame1( | 458 QuicStreamFrame frame1( |
459 stream2->id(), false, 0, MakeIOVector(compressed_headers1)); | 459 stream2->id(), false, 0, MakeIOVector(compressed_headers1)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // Reset the stream, but since the headers have not been decompressed | 513 // Reset the stream, but since the headers have not been decompressed |
514 // it will become a zombie and will continue to process data | 514 // it will become a zombie and will continue to process data |
515 // until the headers are decompressed. | 515 // until the headers are decompressed. |
516 EXPECT_CALL(*connection, SendRstStream(stream_id1, QUIC_STREAM_CANCELLED, 0)); | 516 EXPECT_CALL(*connection, SendRstStream(stream_id1, QUIC_STREAM_CANCELLED, 0)); |
517 session.SendRstStream(stream_id1, QUIC_STREAM_CANCELLED, 0); | 517 session.SendRstStream(stream_id1, QUIC_STREAM_CANCELLED, 0); |
518 | 518 |
519 EXPECT_EQ(1u, session.GetNumOpenStreams()); | 519 EXPECT_EQ(1u, session.GetNumOpenStreams()); |
520 | 520 |
521 vector<QuicStreamFrame> frames; | 521 vector<QuicStreamFrame> frames; |
522 QuicPacketHeader header; | 522 QuicPacketHeader header; |
523 header.public_header.guid = session_.guid(); | 523 header.public_header.connection_id = session_.connection_id(); |
524 | 524 |
525 // Create frame with headers for stream2. | 525 // Create frame with headers for stream2. |
526 QuicSpdyCompressor compressor; | 526 QuicSpdyCompressor compressor; |
527 string compressed_headers1 = compressor.CompressHeaders(headers_); | 527 string compressed_headers1 = compressor.CompressHeaders(headers_); |
528 QuicStreamFrame frame1( | 528 QuicStreamFrame frame1( |
529 stream1->id(), false, 0, MakeIOVector(compressed_headers1)); | 529 stream1->id(), false, 0, MakeIOVector(compressed_headers1)); |
530 | 530 |
531 // Process the second frame first. This will cause the headers to | 531 // Process the second frame first. This will cause the headers to |
532 // be queued up and processed after the first frame is processed. | 532 // be queued up and processed after the first frame is processed. |
533 frames.push_back(frame1); | 533 frames.push_back(frame1); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 588 } |
589 | 589 |
590 QuicRstStreamFrame rst1(stream_id1, QUIC_STREAM_NO_ERROR, 0); | 590 QuicRstStreamFrame rst1(stream_id1, QUIC_STREAM_NO_ERROR, 0); |
591 session_.OnRstStream(rst1); | 591 session_.OnRstStream(rst1); |
592 EXPECT_EQ(0u, session_.GetNumOpenStreams()); | 592 EXPECT_EQ(0u, session_.GetNumOpenStreams()); |
593 } | 593 } |
594 | 594 |
595 } // namespace | 595 } // namespace |
596 } // namespace test | 596 } // namespace test |
597 } // namespace net | 597 } // namespace net |
OLD | NEW |