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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 bool VerifyIovec(const iovec& iovec, StringPiece expected) { | 93 bool VerifyIovec(const iovec& iovec, StringPiece expected) { |
94 if (iovec.iov_len != expected.length()) { | 94 if (iovec.iov_len != expected.length()) { |
95 LOG(ERROR) << "Invalid length: " << iovec.iov_len | 95 LOG(ERROR) << "Invalid length: " << iovec.iov_len |
96 << " vs " << expected.length(); | 96 << " vs " << expected.length(); |
97 return false; | 97 return false; |
98 } | 98 } |
99 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) { | 99 if (memcmp(iovec.iov_base, expected.data(), expected.length()) != 0) { |
100 LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base) | 100 LOG(ERROR) << "Invalid data: " << static_cast<char*>(iovec.iov_base) |
101 << " vs " << expected.data(); | 101 << " vs " << expected; |
102 return false; | 102 return false; |
103 } | 103 } |
104 return true; | 104 return true; |
105 } | 105 } |
106 | 106 |
107 void OnFinFrame(QuicStreamOffset byte_offset, const char* data) { | 107 void OnFinFrame(QuicStreamOffset byte_offset, const char* data) { |
108 QuicStreamFrame frame; | 108 QuicStreamFrame frame; |
109 frame.stream_id = 1; | 109 frame.stream_id = 1; |
110 frame.offset = byte_offset; | 110 frame.offset = byte_offset; |
111 frame.data = StringPiece(data); | 111 frame.data = StringPiece(data); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); | 506 QuicStreamFrame frame2(kClientDataStreamId1, false, 2, StringPiece("hello")); |
507 EXPECT_TRUE(FrameOverlapsBufferedData(frame2)); | 507 EXPECT_TRUE(FrameOverlapsBufferedData(frame2)); |
508 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) | 508 EXPECT_CALL(stream_, CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME, _)) |
509 .Times(1); | 509 .Times(1); |
510 sequencer_->OnStreamFrame(frame2); | 510 sequencer_->OnStreamFrame(frame2); |
511 } | 511 } |
512 | 512 |
513 } // namespace | 513 } // namespace |
514 } // namespace test | 514 } // namespace test |
515 } // namespace net | 515 } // namespace net |
OLD | NEW |