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_stream_sequencer.h" | 5 #include "net/quic/quic_stream_sequencer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void OnFrame(QuicStreamOffset byte_offset, const char* data) { | 94 void OnFrame(QuicStreamOffset byte_offset, const char* data) { |
95 QuicStreamFrame frame; | 95 QuicStreamFrame frame; |
96 frame.stream_id = 1; | 96 frame.stream_id = 1; |
97 frame.offset = byte_offset; | 97 frame.offset = byte_offset; |
98 frame.data = StringPiece(data); | 98 frame.data = StringPiece(data); |
99 frame.fin = false; | 99 frame.fin = false; |
100 sequencer_->OnStreamFrame(frame); | 100 sequencer_->OnStreamFrame(frame); |
101 } | 101 } |
102 | 102 |
103 MockConnection* connection_; | 103 MockConnection* connection_; |
104 MockSession session_; | 104 MockQuicSpdySession session_; |
105 testing::StrictMock<MockStream> stream_; | 105 testing::StrictMock<MockStream> stream_; |
106 scoped_ptr<QuicStreamSequencer> sequencer_; | 106 scoped_ptr<QuicStreamSequencer> sequencer_; |
107 map<QuicStreamOffset, string>* buffered_frames_; | 107 map<QuicStreamOffset, string>* buffered_frames_; |
108 }; | 108 }; |
109 | 109 |
110 TEST_F(QuicStreamSequencerTest, RejectOldFrame) { | 110 TEST_F(QuicStreamSequencerTest, RejectOldFrame) { |
111 EXPECT_CALL(stream_, ProcessRawData(StrEq("abc"), 3)).WillOnce(Return(3)); | 111 EXPECT_CALL(stream_, ProcessRawData(StrEq("abc"), 3)).WillOnce(Return(3)); |
112 | 112 |
113 OnFrame(0, "abc"); | 113 OnFrame(0, "abc"); |
114 EXPECT_EQ(0u, buffered_frames_->size()); | 114 EXPECT_EQ(0u, buffered_frames_->size()); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); | 414 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); |
415 EXPECT_TRUE(sequencer_->FrameOverlapsBufferedData(frame2)); | 415 EXPECT_TRUE(sequencer_->FrameOverlapsBufferedData(frame2)); |
416 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) | 416 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) |
417 .Times(1); | 417 .Times(1); |
418 sequencer_->OnStreamFrame(frame2); | 418 sequencer_->OnStreamFrame(frame2); |
419 } | 419 } |
420 | 420 |
421 } // namespace | 421 } // namespace |
422 } // namespace test | 422 } // namespace test |
423 } // namespace net | 423 } // namespace net |
OLD | NEW |