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 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4531 // packet sequence number | 4531 // packet sequence number |
4532 0xBC, 0x9A, 0x78, 0x56, | 4532 0xBC, 0x9A, 0x78, 0x56, |
4533 0x34, 0x12, | 4533 0x34, 0x12, |
4534 // private flags(entropy) | 4534 // private flags(entropy) |
4535 0x01, | 4535 0x01, |
4536 | 4536 |
4537 // frame type (ping frame) | 4537 // frame type (ping frame) |
4538 0x07, | 4538 0x07, |
4539 }; | 4539 }; |
4540 | 4540 |
4541 if (version_ >= QUIC_VERSION_18) { | 4541 scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames)); |
4542 scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames)); | 4542 ASSERT_TRUE(data != nullptr); |
4543 ASSERT_TRUE(data != nullptr); | |
4544 | 4543 |
4545 test::CompareCharArraysWithHexError("constructed packet", data->data(), | 4544 test::CompareCharArraysWithHexError("constructed packet", data->data(), |
4546 data->length(), AsChars(packet), | 4545 data->length(), AsChars(packet), |
4547 arraysize(packet)); | 4546 arraysize(packet)); |
4548 } else { | |
4549 string expected_error = | |
4550 "Attempt to add a PingFrame in " + QuicVersionToString(version_); | |
4551 EXPECT_DFATAL(BuildDataPacket(header, frames), | |
4552 expected_error); | |
4553 return; | |
4554 } | |
4555 } | 4547 } |
4556 | 4548 |
4557 TEST_P(QuicFramerTest, BuildPublicResetPacket) { | 4549 TEST_P(QuicFramerTest, BuildPublicResetPacket) { |
4558 QuicPublicResetPacket reset_packet; | 4550 QuicPublicResetPacket reset_packet; |
4559 reset_packet.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210); | 4551 reset_packet.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210); |
4560 reset_packet.public_header.reset_flag = true; | 4552 reset_packet.public_header.reset_flag = true; |
4561 reset_packet.public_header.version_flag = false; | 4553 reset_packet.public_header.version_flag = false; |
4562 reset_packet.rejected_sequence_number = GG_UINT64_C(0x123456789ABC); | 4554 reset_packet.rejected_sequence_number = GG_UINT64_C(0x123456789ABC); |
4563 reset_packet.nonce_proof = GG_UINT64_C(0xABCDEF0123456789); | 4555 reset_packet.nonce_proof = GG_UINT64_C(0xABCDEF0123456789); |
4564 | 4556 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5065 EXPECT_CALL(visitor, OnPacketComplete()); | 5057 EXPECT_CALL(visitor, OnPacketComplete()); |
5066 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); | 5058 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); |
5067 | 5059 |
5068 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 5060 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
5069 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); | 5061 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); |
5070 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 5062 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
5071 } | 5063 } |
5072 | 5064 |
5073 } // namespace test | 5065 } // namespace test |
5074 } // namespace net | 5066 } // namespace net |
OLD | NEW |