| 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/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override { | 255 bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override { |
| 256 window_update_frame_ = frame; | 256 window_update_frame_ = frame; |
| 257 return true; | 257 return true; |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool OnBlockedFrame(const QuicBlockedFrame& frame) override { | 260 bool OnBlockedFrame(const QuicBlockedFrame& frame) override { |
| 261 blocked_frame_ = frame; | 261 blocked_frame_ = frame; |
| 262 return true; | 262 return true; |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override { | |
| 266 path_close_frame_ = frame; | |
| 267 return true; | |
| 268 } | |
| 269 | |
| 270 // Counters from the visitor_ callbacks. | 265 // Counters from the visitor_ callbacks. |
| 271 int error_count_; | 266 int error_count_; |
| 272 int version_mismatch_; | 267 int version_mismatch_; |
| 273 int packet_count_; | 268 int packet_count_; |
| 274 int frame_count_; | 269 int frame_count_; |
| 275 int complete_packets_; | 270 int complete_packets_; |
| 276 bool accept_packet_; | 271 bool accept_packet_; |
| 277 bool accept_public_header_; | 272 bool accept_public_header_; |
| 278 | 273 |
| 279 std::unique_ptr<QuicPacketHeader> header_; | 274 std::unique_ptr<QuicPacketHeader> header_; |
| 280 std::unique_ptr<QuicPacketPublicHeader> public_header_; | 275 std::unique_ptr<QuicPacketPublicHeader> public_header_; |
| 281 std::unique_ptr<QuicPublicResetPacket> public_reset_packet_; | 276 std::unique_ptr<QuicPublicResetPacket> public_reset_packet_; |
| 282 std::unique_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 277 std::unique_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
| 283 std::vector<std::unique_ptr<QuicStreamFrame>> stream_frames_; | 278 std::vector<std::unique_ptr<QuicStreamFrame>> stream_frames_; |
| 284 std::vector<std::unique_ptr<QuicAckFrame>> ack_frames_; | 279 std::vector<std::unique_ptr<QuicAckFrame>> ack_frames_; |
| 285 std::vector<std::unique_ptr<QuicStopWaitingFrame>> stop_waiting_frames_; | 280 std::vector<std::unique_ptr<QuicStopWaitingFrame>> stop_waiting_frames_; |
| 286 std::vector<std::unique_ptr<QuicPaddingFrame>> padding_frames_; | 281 std::vector<std::unique_ptr<QuicPaddingFrame>> padding_frames_; |
| 287 std::vector<std::unique_ptr<QuicPingFrame>> ping_frames_; | 282 std::vector<std::unique_ptr<QuicPingFrame>> ping_frames_; |
| 288 QuicRstStreamFrame rst_stream_frame_; | 283 QuicRstStreamFrame rst_stream_frame_; |
| 289 QuicConnectionCloseFrame connection_close_frame_; | 284 QuicConnectionCloseFrame connection_close_frame_; |
| 290 QuicGoAwayFrame goaway_frame_; | 285 QuicGoAwayFrame goaway_frame_; |
| 291 QuicWindowUpdateFrame window_update_frame_; | 286 QuicWindowUpdateFrame window_update_frame_; |
| 292 QuicBlockedFrame blocked_frame_; | 287 QuicBlockedFrame blocked_frame_; |
| 293 QuicPathCloseFrame path_close_frame_; | |
| 294 std::vector<std::unique_ptr<string>> stream_data_; | 288 std::vector<std::unique_ptr<string>> stream_data_; |
| 295 }; | 289 }; |
| 296 | 290 |
| 297 class QuicFramerTest : public ::testing::TestWithParam<QuicVersion> { | 291 class QuicFramerTest : public ::testing::TestWithParam<QuicVersion> { |
| 298 public: | 292 public: |
| 299 QuicFramerTest() | 293 QuicFramerTest() |
| 300 : encrypter_(new test::TestEncrypter()), | 294 : encrypter_(new test::TestEncrypter()), |
| 301 decrypter_(new test::TestDecrypter()), | 295 decrypter_(new test::TestDecrypter()), |
| 302 start_(QuicTime::Zero() + QuicTime::Delta::FromMicroseconds(0x10)), | 296 start_(QuicTime::Zero() + QuicTime::Delta::FromMicroseconds(0x10)), |
| 303 framer_(AllSupportedVersions(), start_, Perspective::IS_SERVER) { | 297 framer_(AllSupportedVersions(), start_, Perspective::IS_SERVER) { |
| (...skipping 3356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3660 'o', ' ', 'w', 'o', | 3654 'o', ' ', 'w', 'o', |
| 3661 'r', 'l', 'd', '!', | 3655 'r', 'l', 'd', '!', |
| 3662 }; | 3656 }; |
| 3663 // clang-format on | 3657 // clang-format on |
| 3664 | 3658 |
| 3665 QuicFramerFuzzFunc(packet, arraysize(packet)); | 3659 QuicFramerFuzzFunc(packet, arraysize(packet)); |
| 3666 } | 3660 } |
| 3667 | 3661 |
| 3668 } // namespace test | 3662 } // namespace test |
| 3669 } // namespace net | 3663 } // namespace net |
| OLD | NEW |