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/test_tools/simple_quic_framer.h" | 5 #include "net/quic/test_tools/simple_quic_framer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 void OnDecryptedPacket(EncryptionLevel level) override {} | 46 void OnDecryptedPacket(EncryptionLevel level) override {} |
47 bool OnPacketHeader(const QuicPacketHeader& header) override { | 47 bool OnPacketHeader(const QuicPacketHeader& header) override { |
48 has_header_ = true; | 48 has_header_ = true; |
49 header_ = header; | 49 header_ = header; |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 bool OnStreamFrame(const QuicStreamFrame& frame) override { | 53 bool OnStreamFrame(const QuicStreamFrame& frame) override { |
54 // Save a copy of the data so it is valid after the packet is processed. | 54 // Save a copy of the data so it is valid after the packet is processed. |
55 string* string_data = new string(); | 55 string* string_data = new string(frame.data_buffer, frame.data_length); |
56 string_data->append(frame.data_buffer, frame.data_length); | |
57 stream_data_.push_back(base::WrapUnique(string_data)); | 56 stream_data_.push_back(base::WrapUnique(string_data)); |
58 // TODO(ianswett): A pointer isn't necessary with emplace_back. | 57 // TODO(ianswett): A pointer isn't necessary with emplace_back. |
59 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( | 58 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( |
60 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); | 59 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); |
61 return true; | 60 return true; |
62 } | 61 } |
63 | 62 |
64 bool OnAckFrame(const QuicAckFrame& frame) override { | 63 bool OnAckFrame(const QuicAckFrame& frame) override { |
65 ack_frames_.push_back(frame); | 64 ack_frames_.push_back(frame); |
66 return true; | 65 return true; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return visitor_->goaway_frames(); | 227 return visitor_->goaway_frames(); |
229 } | 228 } |
230 | 229 |
231 const std::vector<QuicConnectionCloseFrame>& | 230 const std::vector<QuicConnectionCloseFrame>& |
232 SimpleQuicFramer::connection_close_frames() const { | 231 SimpleQuicFramer::connection_close_frames() const { |
233 return visitor_->connection_close_frames(); | 232 return visitor_->connection_close_frames(); |
234 } | 233 } |
235 | 234 |
236 } // namespace test | 235 } // namespace test |
237 } // namespace net | 236 } // namespace net |
OLD | NEW |