Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: net/quic/core/quic_framer_test.cc

Issue 2962203002: Replace a DCHECK with a return false, when processing invalid stop waiting data. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_framer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 expected_error = "Unable to read least unacked delta."; 2072 expected_error = "Unable to read least unacked delta.";
2073 CheckProcessingFails( 2073 CheckProcessingFails(
2074 framer_.version() <= QUIC_VERSION_38 ? packet : packet39, 2074 framer_.version() <= QUIC_VERSION_38 ? packet : packet39,
2075 i + GetPacketHeaderSize(framer_.version(), PACKET_8BYTE_CONNECTION_ID, 2075 i + GetPacketHeaderSize(framer_.version(), PACKET_8BYTE_CONNECTION_ID,
2076 !kIncludeVersion, !kIncludeDiversificationNonce, 2076 !kIncludeVersion, !kIncludeDiversificationNonce,
2077 PACKET_6BYTE_PACKET_NUMBER), 2077 PACKET_6BYTE_PACKET_NUMBER),
2078 expected_error, QUIC_INVALID_STOP_WAITING_DATA); 2078 expected_error, QUIC_INVALID_STOP_WAITING_DATA);
2079 } 2079 }
2080 } 2080 }
2081 2081
2082 TEST_P(QuicFramerTest, InvalidNewStopWaitingFrame) {
2083 // clang-format off
2084 unsigned char packet[] = {
2085 // public flags (8 byte connection_id)
2086 0x3C,
2087 // connection_id
2088 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
2089 // packet number
2090 0xA8, 0x9A, 0x78, 0x56,
2091 0x34, 0x12,
2092 // frame type (stop waiting frame)
2093 0x06,
2094 // least packet number awaiting an ack, delta from packet number.
2095 0xA8, 0x9A, 0x78, 0x56,
2096 0x34, 0x13,
2097 };
2098
2099 unsigned char packet39[] = {
2100 // public flags (8 byte connection_id)
2101 0x3C,
2102 // connection_id
2103 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
2104 // packet number
2105 0x12, 0x34, 0x56, 0x78,
2106 0x9A, 0xA8,
2107 // frame type (stop waiting frame)
2108 0x06,
2109 // least packet number awaiting an ack, delta from packet number.
2110 0x13, 0x34, 0x56, 0x78,
2111 0x9A, 0xA8,
2112 };
2113 // clang-format on
2114
2115 QuicEncryptedPacket encrypted(
2116 AsChars(framer_.version() <= QUIC_VERSION_38 ? packet : packet39),
2117 arraysize(packet), false);
2118 EXPECT_FALSE(framer_.ProcessPacket(encrypted));
2119 EXPECT_EQ(QUIC_INVALID_STOP_WAITING_DATA, framer_.error());
2120 EXPECT_EQ("Invalid unacked delta.", framer_.detailed_error());
2121 }
2122
2082 TEST_P(QuicFramerTest, RstStreamFrameQuic) { 2123 TEST_P(QuicFramerTest, RstStreamFrameQuic) {
2083 // clang-format off 2124 // clang-format off
2084 unsigned char packet[] = { 2125 unsigned char packet[] = {
2085 // public flags (8 byte connection_id) 2126 // public flags (8 byte connection_id)
2086 0x38, 2127 0x38,
2087 // connection_id 2128 // connection_id
2088 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, 2129 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
2089 // packet number 2130 // packet number
2090 0xBC, 0x9A, 0x78, 0x56, 2131 0xBC, 0x9A, 0x78, 0x56,
2091 0x34, 0x12, 2132 0x34, 0x12,
(...skipping 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 }; 4727 };
4687 // clang-format on 4728 // clang-format on
4688 4729
4689 QuicFramerFuzzFunc(framer_.version() <= QUIC_VERSION_38 ? packet : packet39, 4730 QuicFramerFuzzFunc(framer_.version() <= QUIC_VERSION_38 ? packet : packet39,
4690 arraysize(packet)); 4731 arraysize(packet));
4691 } 4732 }
4692 4733
4693 } // namespace 4734 } // namespace
4694 } // namespace test 4735 } // namespace test
4695 } // namespace net 4736 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_framer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698