| 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_framer.h" | 5 #include "net/quic/quic_framer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 630 |
| 631 memset(packet + GetPacketHeaderSize( | 631 memset(packet + GetPacketHeaderSize( |
| 632 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, | 632 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, |
| 633 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP), 0, | 633 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP), 0, |
| 634 kMaxPacketSize - GetPacketHeaderSize( | 634 kMaxPacketSize - GetPacketHeaderSize( |
| 635 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, | 635 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, |
| 636 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP) + 1); | 636 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP) + 1); |
| 637 // clang-format on | 637 // clang-format on |
| 638 | 638 |
| 639 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 639 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
| 640 EXPECT_FALSE(framer_.ProcessPacket(encrypted)); | 640 EXPECT_DFATAL(framer_.ProcessPacket(encrypted), "Packet too large:1"); |
| 641 | 641 |
| 642 ASSERT_TRUE(visitor_.header_.get()); | 642 ASSERT_TRUE(visitor_.header_.get()); |
| 643 // Make sure we've parsed the packet header, so we can send an error. | 643 // Make sure we've parsed the packet header, so we can send an error. |
| 644 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id); | 644 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id); |
| 645 // Make sure the correct error is propagated. | 645 // Make sure the correct error is propagated. |
| 646 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error()); | 646 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error()); |
| 647 } | 647 } |
| 648 | 648 |
| 649 TEST_P(QuicFramerTest, PacketHeader) { | 649 TEST_P(QuicFramerTest, PacketHeader) { |
| 650 // clang-format off | 650 // clang-format off |
| (...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4668 'o', ' ', 'w', 'o', | 4668 'o', ' ', 'w', 'o', |
| 4669 'r', 'l', 'd', '!', | 4669 'r', 'l', 'd', '!', |
| 4670 }; | 4670 }; |
| 4671 // clang-format on | 4671 // clang-format on |
| 4672 | 4672 |
| 4673 QuicFramerFuzzFunc(packet, arraysize(packet)); | 4673 QuicFramerFuzzFunc(packet, arraysize(packet)); |
| 4674 } | 4674 } |
| 4675 | 4675 |
| 4676 } // namespace test | 4676 } // namespace test |
| 4677 } // namespace net | 4677 } // namespace net |
| OLD | NEW |