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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
56 StringPiece(frame.data_buffer, frame.data_length) | 56 string_data->append(frame.data_buffer, frame.data_length); |
57 .AppendToString(string_data); | |
58 stream_data_.push_back(base::WrapUnique(string_data)); | 57 stream_data_.push_back(base::WrapUnique(string_data)); |
59 // TODO(ianswett): A pointer isn't necessary with emplace_back. | 58 // TODO(ianswett): A pointer isn't necessary with emplace_back. |
60 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( | 59 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( |
61 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); | 60 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); |
62 return true; | 61 return true; |
63 } | 62 } |
64 | 63 |
65 bool OnAckFrame(const QuicAckFrame& frame) override { | 64 bool OnAckFrame(const QuicAckFrame& frame) override { |
66 ack_frames_.push_back(frame); | 65 ack_frames_.push_back(frame); |
67 return true; | 66 return true; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 return visitor_->goaway_frames(); | 228 return visitor_->goaway_frames(); |
230 } | 229 } |
231 | 230 |
232 const std::vector<QuicConnectionCloseFrame>& | 231 const std::vector<QuicConnectionCloseFrame>& |
233 SimpleQuicFramer::connection_close_frames() const { | 232 SimpleQuicFramer::connection_close_frames() const { |
234 return visitor_->connection_close_frames(); | 233 return visitor_->connection_close_frames(); |
235 } | 234 } |
236 | 235 |
237 } // namespace test | 236 } // namespace test |
238 } // namespace net | 237 } // namespace net |
OLD | NEW |