| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2929 string expected_error = "Unable to read stream_id."; | 2929 string expected_error = "Unable to read stream_id."; |
| 2930 CheckProcessingFails( | 2930 CheckProcessingFails( |
| 2931 packet, | 2931 packet, |
| 2932 i + GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, | 2932 i + GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, |
| 2933 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP), | 2933 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP), |
| 2934 expected_error, QUIC_INVALID_BLOCKED_DATA); | 2934 expected_error, QUIC_INVALID_BLOCKED_DATA); |
| 2935 } | 2935 } |
| 2936 } | 2936 } |
| 2937 | 2937 |
| 2938 TEST_P(QuicFramerTest, PingFrame) { | 2938 TEST_P(QuicFramerTest, PingFrame) { |
| 2939 if (version_ <= QUIC_VERSION_17) { | 2939 if (version_ <= QUIC_VERSION_16) { |
| 2940 return; | 2940 return; |
| 2941 } | 2941 } |
| 2942 | 2942 |
| 2943 unsigned char packet[] = { | 2943 unsigned char packet[] = { |
| 2944 // public flags (8 byte connection_id) | 2944 // public flags (8 byte connection_id) |
| 2945 0x3C, | 2945 0x3C, |
| 2946 // connection_id | 2946 // connection_id |
| 2947 0x10, 0x32, 0x54, 0x76, | 2947 0x10, 0x32, 0x54, 0x76, |
| 2948 0x98, 0xBA, 0xDC, 0xFE, | 2948 0x98, 0xBA, 0xDC, 0xFE, |
| 2949 // packet sequence number | 2949 // packet sequence number |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4406 // packet sequence number | 4406 // packet sequence number |
| 4407 0xBC, 0x9A, 0x78, 0x56, | 4407 0xBC, 0x9A, 0x78, 0x56, |
| 4408 0x34, 0x12, | 4408 0x34, 0x12, |
| 4409 // private flags(entropy) | 4409 // private flags(entropy) |
| 4410 0x01, | 4410 0x01, |
| 4411 | 4411 |
| 4412 // frame type (ping frame) | 4412 // frame type (ping frame) |
| 4413 0x07, | 4413 0x07, |
| 4414 }; | 4414 }; |
| 4415 | 4415 |
| 4416 if (version_ > QUIC_VERSION_17) { | 4416 if (version_ >= QUIC_VERSION_18) { |
| 4417 scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames)); | 4417 scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames)); |
| 4418 ASSERT_TRUE(data != NULL); | 4418 ASSERT_TRUE(data != NULL); |
| 4419 | 4419 |
| 4420 test::CompareCharArraysWithHexError("constructed packet", data->data(), | 4420 test::CompareCharArraysWithHexError("constructed packet", data->data(), |
| 4421 data->length(), AsChars(packet), | 4421 data->length(), AsChars(packet), |
| 4422 arraysize(packet)); | 4422 arraysize(packet)); |
| 4423 } else { | 4423 } else { |
| 4424 string expected_error = | 4424 string expected_error = |
| 4425 "Attempt to add a PingFrame in " + QuicVersionToString(version_); | 4425 "Attempt to add a PingFrame in " + QuicVersionToString(version_); |
| 4426 EXPECT_DFATAL(BuildDataPacket(header, frames), | 4426 EXPECT_DFATAL(BuildDataPacket(header, frames), |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4951 EXPECT_CALL(visitor, OnPacketComplete()); | 4951 EXPECT_CALL(visitor, OnPacketComplete()); |
| 4952 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); | 4952 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); |
| 4953 | 4953 |
| 4954 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 4954 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
| 4955 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); | 4955 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); |
| 4956 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 4956 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
| 4957 } | 4957 } |
| 4958 | 4958 |
| 4959 } // namespace test | 4959 } // namespace test |
| 4960 } // namespace net | 4960 } // namespace net |
| OLD | NEW |