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

Unified Diff: net/quic/quic_framer_test.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_framer_test.cc
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc
index b2dc6eb1202a3784d6e8c004bd7e437776d8f302..bb852a0a2d40025a0c7a80091d4240cbd380d7ec 100644
--- a/net/quic/quic_framer_test.cc
+++ b/net/quic/quic_framer_test.cc
@@ -181,7 +181,6 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
~TestQuicVisitor() override {
STLDeleteElements(&stream_frames_);
STLDeleteElements(&ack_frames_);
- STLDeleteElements(&congestion_feedback_frames_);
STLDeleteElements(&stop_waiting_frames_);
STLDeleteElements(&ping_frames_);
STLDeleteElements(&fec_data_);
@@ -246,14 +245,6 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
return true;
}
- bool OnCongestionFeedbackFrame(
- const QuicCongestionFeedbackFrame& frame) override {
- ++frame_count_;
- congestion_feedback_frames_.push_back(
- new QuicCongestionFeedbackFrame(frame));
- return true;
- }
-
bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override {
++frame_count_;
stop_waiting_frames_.push_back(new QuicStopWaitingFrame(frame));
@@ -315,7 +306,6 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_;
vector<QuicStreamFrame*> stream_frames_;
vector<QuicAckFrame*> ack_frames_;
- vector<QuicCongestionFeedbackFrame*> congestion_feedback_frames_;
vector<QuicStopWaitingFrame*> stop_waiting_frames_;
vector<QuicPingFrame*> ping_frames_;
vector<QuicFecData*> fec_data_;
@@ -594,16 +584,26 @@ TEST_P(QuicFramerTest, EmptyPacket) {
TEST_P(QuicFramerTest, LargePacket) {
unsigned char packet[kMaxPacketSize + 1] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10,
+ 0x32,
+ 0x54,
+ 0x76,
+ 0x98,
+ 0xBA,
+ 0xDC,
+ 0xFE,
+ // packet sequence number
+ 0xBC,
+ 0x9A,
+ 0x78,
+ 0x56,
+ 0x34,
+ 0x12,
+ // private flags
+ 0x00,
};
memset(packet + GetPacketHeaderSize(
@@ -1654,145 +1654,44 @@ TEST_P(QuicFramerTest, StreamFrameInFecGroup) {
CheckStreamFrameData("hello world!", visitor_.stream_frames_[0]);
}
-TEST_P(QuicFramerTest, AckFramev22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x00,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_TRUE(framer_.ProcessPacket(encrypted));
-
- EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
- ASSERT_TRUE(visitor_.header_.get());
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
-
- EXPECT_EQ(0u, visitor_.stream_frames_.size());
- ASSERT_EQ(1u, visitor_.ack_frames_.size());
- const QuicAckFrame& frame = *visitor_.ack_frames_[0];
- EXPECT_EQ(0xBA, frame.entropy_hash);
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame.largest_observed);
- ASSERT_EQ(1u, frame.missing_packets.size());
- SequenceNumberSet::const_iterator missing_iter =
- frame.missing_packets.begin();
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABE), *missing_iter);
-
- const size_t kReceivedEntropyOffset = kQuicFrameTypeSize;
- const size_t kLargestObservedOffset = kReceivedEntropyOffset +
- kQuicEntropyHashSize;
- const size_t kMissingDeltaTimeOffset = kLargestObservedOffset +
- PACKET_6BYTE_SEQUENCE_NUMBER;
- const size_t kNumMissingPacketOffset = kMissingDeltaTimeOffset +
- kQuicDeltaTimeLargestObservedSize;
- const size_t kMissingPacketsOffset = kNumMissingPacketOffset +
- kNumberOfNackRangesSize;
- const size_t kMissingPacketsRange = kMissingPacketsOffset +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- const size_t kRevivedPacketsLength = kMissingPacketsRange +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- // Now test framing boundaries.
- const size_t ack_frame_size = kRevivedPacketsLength +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- for (size_t i = kQuicFrameTypeSize; i < ack_frame_size; ++i) {
- string expected_error;
- if (i < kLargestObservedOffset) {
- expected_error = "Unable to read entropy hash for received packets.";
- } else if (i < kMissingDeltaTimeOffset) {
- expected_error = "Unable to read largest observed.";
- } else if (i < kNumMissingPacketOffset) {
- expected_error = "Unable to read delta time largest observed.";
- } else if (i < kMissingPacketsOffset) {
- expected_error = "Unable to read num missing packet ranges.";
- } else if (i < kMissingPacketsRange) {
- expected_error = "Unable to read missing sequence number delta.";
- } else if (i < kRevivedPacketsLength) {
- expected_error = "Unable to read missing sequence number range.";
- } else {
- expected_error = "Unable to read num revived packets.";
- }
- CheckProcessingFails(
- packet,
- i + GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
- PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP),
- expected_error, QUIC_INVALID_ACK_DATA);
- }
-}
-
-
TEST_P(QuicFramerTest, AckFrameTwoTimestamp) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // Number of timestamps.
- 0x02,
- // Delta from largest observed.
- 0x01,
- // Delta time.
- 0x10, 0x32, 0x54, 0x76,
- // Delta from largest observed.
- 0x02,
- // Delta time.
- 0x10, 0x32,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // Number of timestamps.
+ 0x02,
+ // Delta from largest observed.
+ 0x01,
+ // Delta time.
+ 0x10, 0x32, 0x54, 0x76,
+ // Delta from largest observed.
+ 0x02,
+ // Delta time.
+ 0x10, 0x32,
+ // num missing packets
+ 0x01,
+ // missing packet delta
+ 0x01,
+ // 0 more missing packets in range.
+ 0x00,
+ // Number of revived packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -1877,45 +1776,39 @@ TEST_P(QuicFramerTest, AckFrameTwoTimestamp) {
TEST_P(QuicFramerTest, AckFrameOneTimestamp) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // Number of timestamps.
- 0x01,
- // Delta from largest observed.
- 0x01,
- // Delta time.
- 0x10, 0x32, 0x54, 0x76,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // Number of timestamps.
+ 0x01,
+ // Delta from largest observed.
+ 0x01,
+ // Delta time.
+ 0x10, 0x32, 0x54, 0x76,
+ // num missing packets
+ 0x01,
+ // missing packet delta
+ 0x01,
+ // 0 more missing packets in range.
+ 0x00,
+ // Number of revived packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -1990,41 +1883,35 @@ TEST_P(QuicFramerTest, AckFrameOneTimestamp) {
TEST_P(QuicFramerTest, AckFrame) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // Number of timestamps.
- 0x00,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // Number of timestamps.
+ 0x00,
+ // num missing packets
+ 0x01,
+ // missing packet delta
+ 0x01,
+ // 0 more missing packets in range.
+ 0x00,
+ // Number of revived packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -2090,46 +1977,39 @@ TEST_P(QuicFramerTest, AckFrame) {
}
TEST_P(QuicFramerTest, AckFrameRevivedPackets) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num received packets.
- 0x00,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x01,
- // Revived packet sequence number.
- 0xBE, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Number of revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // num received packets.
+ 0x00,
+ // num missing packets
+ 0x01,
+ // missing packet delta
+ 0x01,
+ // 0 more missing packets in range.
+ 0x00,
+ // Number of revived packets.
+ 0x01,
+ // Revived packet sequence number.
+ 0xBE, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Number of revived packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -2200,45 +2080,28 @@ TEST_P(QuicFramerTest, AckFrameRevivedPackets) {
}
}
-TEST_P(QuicFramerTest, AckFrameRevivedPacketsv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
+TEST_P(QuicFramerTest, AckFrameNoNacks) {
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packets
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // Number of revived packets.
- 0x01,
- // Revived packet sequence number.
- 0xBE, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Number of revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (no nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x4C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // Number of received packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -2250,230 +2113,10 @@ TEST_P(QuicFramerTest, AckFrameRevivedPacketsv22) {
EXPECT_EQ(0u, visitor_.stream_frames_.size());
ASSERT_EQ(1u, visitor_.ack_frames_.size());
- const QuicAckFrame& frame = *visitor_.ack_frames_[0];
- EXPECT_EQ(0xBA, frame.entropy_hash);
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame.largest_observed);
- ASSERT_EQ(1u, frame.missing_packets.size());
- SequenceNumberSet::const_iterator missing_iter =
- frame.missing_packets.begin();
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABE), *missing_iter);
-
- const size_t kReceivedEntropyOffset = kQuicFrameTypeSize;
- const size_t kLargestObservedOffset = kReceivedEntropyOffset +
- kQuicEntropyHashSize;
- const size_t kMissingDeltaTimeOffset = kLargestObservedOffset +
- PACKET_6BYTE_SEQUENCE_NUMBER;
- const size_t kNumMissingPacketOffset = kMissingDeltaTimeOffset +
- kQuicDeltaTimeLargestObservedSize;
- const size_t kMissingPacketsOffset = kNumMissingPacketOffset +
- kNumberOfNackRangesSize;
- const size_t kMissingPacketsRange = kMissingPacketsOffset +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- const size_t kRevivedPacketsLength = kMissingPacketsRange +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- const size_t kRevivedPacketSequenceNumberLength = kRevivedPacketsLength +
- PACKET_1BYTE_SEQUENCE_NUMBER;
- // Now test framing boundaries.
- const size_t ack_frame_size = kRevivedPacketSequenceNumberLength +
- PACKET_6BYTE_SEQUENCE_NUMBER;
- for (size_t i = kQuicFrameTypeSize; i < ack_frame_size; ++i) {
- string expected_error;
- if (i < kReceivedEntropyOffset) {
- expected_error = "Unable to read least unacked delta.";
- } else if (i < kLargestObservedOffset) {
- expected_error = "Unable to read entropy hash for received packets.";
- } else if (i < kMissingDeltaTimeOffset) {
- expected_error = "Unable to read largest observed.";
- } else if (i < kNumMissingPacketOffset) {
- expected_error = "Unable to read delta time largest observed.";
- } else if (i < kMissingPacketsOffset) {
- expected_error = "Unable to read num missing packet ranges.";
- } else if (i < kMissingPacketsRange) {
- expected_error = "Unable to read missing sequence number delta.";
- } else if (i < kRevivedPacketsLength) {
- expected_error = "Unable to read missing sequence number range.";
- } else if (i < kRevivedPacketSequenceNumberLength) {
- expected_error = "Unable to read num revived packets.";
- } else {
- expected_error = "Unable to read revived packet.";
- }
- CheckProcessingFails(
- packet,
- i + GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
- PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP),
- expected_error, QUIC_INVALID_ACK_DATA);
- }
-}
-
-TEST_P(QuicFramerTest, AckFrameNoNacksv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (no nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x4C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_TRUE(framer_.ProcessPacket(encrypted));
-
- EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
- ASSERT_TRUE(visitor_.header_.get());
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
-
- EXPECT_EQ(0u, visitor_.stream_frames_.size());
- ASSERT_EQ(1u, visitor_.ack_frames_.size());
- QuicAckFrame* frame = visitor_.ack_frames_[0];
- EXPECT_EQ(0xBA, frame->entropy_hash);
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame->largest_observed);
- ASSERT_EQ(0u, frame->missing_packets.size());
-
- // Verify that the packet re-serializes identically.
- QuicFrames frames;
- frames.push_back(QuicFrame(frame));
- scoped_ptr<QuicPacket> data(BuildDataPacket(*visitor_.header_, frames));
- ASSERT_TRUE(data != nullptr);
-
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
-TEST_P(QuicFramerTest, AckFrameNoNacks) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (no nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x4C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // Number of received packets.
- 0x00,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_TRUE(framer_.ProcessPacket(encrypted));
-
- EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
- ASSERT_TRUE(visitor_.header_.get());
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
-
- EXPECT_EQ(0u, visitor_.stream_frames_.size());
- ASSERT_EQ(1u, visitor_.ack_frames_.size());
- QuicAckFrame* frame = visitor_.ack_frames_[0];
- EXPECT_EQ(0xBA, frame->entropy_hash);
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame->largest_observed);
- ASSERT_EQ(0u, frame->missing_packets.size());
-
- // Verify that the packet re-serializes identically.
- QuicFrames frames;
- frames.push_back(QuicFrame(frame));
- scoped_ptr<QuicPacket> data(BuildDataPacket(*visitor_.header_, frames));
- ASSERT_TRUE(data != nullptr);
-
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
-TEST_P(QuicFramerTest, AckFrame500Nacksv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges
- 0x02,
- // missing packet delta
- 0x01,
- // 243 more missing packets in range.
- // The ranges are listed in this order so the re-constructed packet matches.
- 0xF3,
- // No gap between ranges
- 0x00,
- // 255 more missing packets in range.
- 0xFF,
- // No revived packets.
- 0x00,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_TRUE(framer_.ProcessPacket(encrypted));
-
- EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
- ASSERT_TRUE(visitor_.header_.get());
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
-
- EXPECT_EQ(0u, visitor_.stream_frames_.size());
- ASSERT_EQ(1u, visitor_.ack_frames_.size());
- QuicAckFrame* frame = visitor_.ack_frames_[0];
- EXPECT_EQ(0xBA, frame->entropy_hash);
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame->largest_observed);
- EXPECT_EQ(0u, frame->revived_packets.size());
- ASSERT_EQ(500u, frame->missing_packets.size());
- SequenceNumberSet::const_iterator first_missing_iter =
- frame->missing_packets.begin();
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABE) - 499, *first_missing_iter);
- SequenceNumberSet::const_reverse_iterator last_missing_iter =
- frame->missing_packets.rbegin();
- EXPECT_EQ(GG_UINT64_C(0x0123456789ABE), *last_missing_iter);
+ QuicAckFrame* frame = visitor_.ack_frames_[0];
+ EXPECT_EQ(0xBA, frame->entropy_hash);
+ EXPECT_EQ(GG_UINT64_C(0x0123456789ABF), frame->largest_observed);
+ ASSERT_EQ(0u, frame->missing_packets.size());
// Verify that the packet re-serializes identically.
QuicFrames frames;
@@ -2481,52 +2124,47 @@ TEST_P(QuicFramerTest, AckFrame500Nacksv22) {
scoped_ptr<QuicPacket> data(BuildDataPacket(*visitor_.header_, frames));
ASSERT_TRUE(data != nullptr);
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
+ test::CompareCharArraysWithHexError("constructed packet", data->data(),
+ data->length(), AsChars(packet),
+ arraysize(packet));
}
TEST_P(QuicFramerTest, AckFrame500Nacks) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0xBA,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // No received packets.
- 0x00,
- // num missing packet ranges
- 0x02,
- // missing packet delta
- 0x01,
- // 243 more missing packets in range.
- // The ranges are listed in this order so the re-constructed packet matches.
- 0xF3,
- // No gap between ranges
- 0x00,
- // 255 more missing packets in range.
- 0xFF,
- // No revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0xBA,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // No received packets.
+ 0x00,
+ // num missing packet ranges
+ 0x02,
+ // missing packet delta
+ 0x01,
+ // 243 more missing packets in range.
+ // The ranges are listed in this order so the re-constructed packet
+ // matches.
+ 0xF3,
+ // No gap between ranges
+ 0x00,
+ // 255 more missing packets in range.
+ 0xFF,
+ // No revived packets.
+ 0x00,
};
QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
@@ -2561,82 +2199,6 @@ TEST_P(QuicFramerTest, AckFrame500Nacks) {
AsChars(packet), arraysize(packet));
}
-TEST_P(QuicFramerTest, CongestionFeedbackFrameTCP) {
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags
- 0x00,
-
- // frame type (congestion feedback frame)
- 0x20,
- // congestion feedback type (tcp)
- 0x00,
- // ack_frame.feedback.tcp.receive_window
- 0x03, 0x04,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_TRUE(framer_.ProcessPacket(encrypted));
-
- EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
- ASSERT_TRUE(visitor_.header_.get());
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
-
- EXPECT_EQ(0u, visitor_.stream_frames_.size());
- ASSERT_EQ(1u, visitor_.congestion_feedback_frames_.size());
- const QuicCongestionFeedbackFrame& frame =
- *visitor_.congestion_feedback_frames_[0];
- ASSERT_EQ(kTCP, frame.type);
- EXPECT_EQ(0x4030u, frame.tcp.receive_window);
-
- // Now test framing boundaries.
- for (size_t i = kQuicFrameTypeSize; i < 4; ++i) {
- string expected_error;
- if (i < 2) {
- expected_error = "Unable to read congestion feedback type.";
- } else if (i < 4) {
- expected_error = "Unable to read receive window.";
- }
- CheckProcessingFails(
- packet,
- i + GetPacketHeaderSize(PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
- PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP),
- expected_error, QUIC_INVALID_CONGESTION_FEEDBACK_DATA);
- }
-}
-
-TEST_P(QuicFramerTest, CongestionFeedbackFrameInvalidFeedback) {
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags
- 0x00,
-
- // frame type (congestion feedback frame)
- 0x20,
- // congestion feedback type (invalid)
- 0x03,
- };
-
- QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
- EXPECT_FALSE(framer_.ProcessPacket(encrypted));
- EXPECT_TRUE(CheckDecryption(encrypted, !kIncludeVersion));
- EXPECT_EQ(QUIC_INVALID_CONGESTION_FEEDBACK_DATA, framer_.error());
-}
-
TEST_P(QuicFramerTest, StopWaitingFrame) {
unsigned char packet[] = {
// public flags (8 byte connection_id)
@@ -3500,31 +3062,26 @@ TEST_P(QuicFramerTest, BuildStreamFramePacketInFecGroup) {
QuicFrames frames;
frames.push_back(QuicFrame(&stream_frame));
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy, is_in_fec_group)
- 0x03,
- // FEC group
- 0x00,
- // frame type (stream frame with fin and data length field)
- 0xFF,
- // stream id
- 0x04, 0x03, 0x02, 0x01,
- // offset
- 0x54, 0x76, 0x10, 0x32,
- 0xDC, 0xFE, 0x98, 0xBA,
- // data length (since packet is in an FEC group)
- 0x0C, 0x00,
- // data
- 'h', 'e', 'l', 'l',
- 'o', ' ', 'w', 'o',
- 'r', 'l', 'd', '!',
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy, is_in_fec_group)
+ 0x03,
+ // FEC group
+ 0x00,
+ // frame type (stream frame with fin and data length field)
+ 0xFF,
+ // stream id
+ 0x04, 0x03, 0x02, 0x01,
+ // offset
+ 0x54, 0x76, 0x10, 0x32, 0xDC, 0xFE, 0x98, 0xBA,
+ // data length (since packet is in an FEC group)
+ 0x0C, 0x00,
+ // data
+ 'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!',
};
scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames));
@@ -3555,30 +3112,61 @@ TEST_P(QuicFramerTest, BuildStreamFramePacketWithVersionFlag) {
frames.push_back(QuicFrame(&stream_frame));
unsigned char packet[] = {
- // public flags (version, 8 byte connection_id)
- 0x3D,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // version tag
- 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (stream frame with fin and no length)
- 0xDF,
- // stream id
- 0x04, 0x03, 0x02, 0x01,
- // offset
- 0x54, 0x76, 0x10, 0x32,
- 0xDC, 0xFE, 0x98, 0xBA,
- // data
- 'h', 'e', 'l', 'l',
- 'o', ' ', 'w', 'o',
- 'r', 'l', 'd', '!',
+ // public flags (version, 8 byte connection_id)
+ 0x3D,
+ // connection_id
+ 0x10,
+ 0x32,
+ 0x54,
+ 0x76,
+ 0x98,
+ 0xBA,
+ 0xDC,
+ 0xFE,
+ // version tag
+ 'Q',
+ '0',
+ GetQuicVersionDigitTens(),
+ GetQuicVersionDigitOnes(),
+ // packet sequence number
+ 0xBC,
+ 0x9A,
+ 0x78,
+ 0x56,
+ 0x34,
+ 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (stream frame with fin and no length)
+ 0xDF,
+ // stream id
+ 0x04,
+ 0x03,
+ 0x02,
+ 0x01,
+ // offset
+ 0x54,
+ 0x76,
+ 0x10,
+ 0x32,
+ 0xDC,
+ 0xFE,
+ 0x98,
+ 0xBA,
+ // data
+ 'h',
+ 'e',
+ 'l',
+ 'l',
+ 'o',
+ ' ',
+ 'w',
+ 'o',
+ 'r',
+ 'l',
+ 'd',
+ '!',
};
QuicFramerPeer::SetIsServer(&framer_, false);
@@ -3597,13 +3185,22 @@ TEST_P(QuicFramerTest, BuildVersionNegotiationPacket) {
header.version_flag = true;
unsigned char packet[] = {
- // public flags (version, 8 byte connection_id)
- 0x0D,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // version tag
- 'Q', '0', GetQuicVersionDigitTens(), GetQuicVersionDigitOnes(),
+ // public flags (version, 8 byte connection_id)
+ 0x0D,
+ // connection_id
+ 0x10,
+ 0x32,
+ 0x54,
+ 0x76,
+ 0x98,
+ 0xBA,
+ 0xDC,
+ 0xFE,
+ // version tag
+ 'Q',
+ '0',
+ GetQuicVersionDigitTens(),
+ GetQuicVersionDigitOnes(),
};
QuicVersionVector versions;
@@ -3611,78 +3208,12 @@ TEST_P(QuicFramerTest, BuildVersionNegotiationPacket) {
scoped_ptr<QuicEncryptedPacket> data(
framer_.BuildVersionNegotiationPacket(header, versions));
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
-TEST_P(QuicFramerTest, BuildAckFramePacketv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = true;
- header.packet_sequence_number = GG_UINT64_C(0x770123456789AA8);
- header.fec_group = 0;
-
- QuicAckFrame ack_frame;
- ack_frame.entropy_hash = 0x43;
- ack_frame.largest_observed = GG_UINT64_C(0x770123456789ABF);
- ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
- ack_frame.missing_packets.insert(
- GG_UINT64_C(0x770123456789ABE));
-
- QuicFrames frames;
- frames.push_back(QuicFrame(&ack_frame));
-
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0x43,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // 0 revived packets.
- 0x00,
- };
-
- scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames));
- ASSERT_TRUE(data != nullptr);
-
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
+ test::CompareCharArraysWithHexError("constructed packet", data->data(),
+ data->length(), AsChars(packet),
+ arraysize(packet));
}
TEST_P(QuicFramerTest, BuildAckFramePacket) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
header.public_header.reset_flag = false;
@@ -3696,44 +3227,40 @@ TEST_P(QuicFramerTest, BuildAckFramePacket) {
ack_frame.entropy_hash = 0x43;
ack_frame.largest_observed = GG_UINT64_C(0x770123456789ABF);
ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
- ack_frame.missing_packets.insert(
- GG_UINT64_C(0x770123456789ABE));
+ ack_frame.missing_packets.insert(GG_UINT64_C(0x770123456789ABE));
QuicFrames frames;
frames.push_back(QuicFrame(&ack_frame));
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
- 0x6C,
- // entropy hash of all received packets.
- 0x43,
- // largest observed packet sequence number
- 0xBF, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // Zero delta time.
- 0x0, 0x0,
- // num received packets.
- 0x00,
- // num missing packet ranges
- 0x01,
- // missing packet delta
- 0x01,
- // 0 more missing packets in range.
- 0x00,
- // 0 revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, not truncated, 6 byte largest observed, 1 byte delta)
+ 0x6C,
+ // entropy hash of all received packets.
+ 0x43,
+ // largest observed packet sequence number
+ 0xBF, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // Zero delta time.
+ 0x00, 0x00,
+ // num received packets.
+ 0x00,
+ // num missing packet ranges
+ 0x01,
+ // missing packet delta
+ 0x01,
+ // 0 more missing packets in range.
+ 0x00,
+ // 0 revived packets.
+ 0x00,
};
scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames));
@@ -3747,125 +3274,7 @@ TEST_P(QuicFramerTest, BuildAckFramePacket) {
// TODO(jri): Add test for tuncated packets in which the original ack frame had
// revived packets. (In both the large and small packet cases below).
-TEST_P(QuicFramerTest, BuildTruncatedAckFrameLargePacketv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = true;
- header.packet_sequence_number = GG_UINT64_C(0x770123456789AA8);
- header.fec_group = 0;
-
- QuicAckFrame ack_frame;
- // This entropy hash is different from what shows up in the packet below,
- // since entropy is recomputed by the framer on ack truncation (by
- // TestEntropyCalculator for this test.)
- ack_frame.entropy_hash = 0x43;
- ack_frame.largest_observed = 2 * 300;
- ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
- for (size_t i = 1; i < 2 * 300; i += 2) {
- ack_frame.missing_packets.insert(i);
- }
-
- QuicFrames frames;
- frames.push_back(QuicFrame(&ack_frame));
-
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
- 0x74,
- // entropy hash of all received packets, set to 1 by TestEntropyCalculator
- // since ack is truncated.
- 0x01,
- // 2-byte largest observed packet sequence number.
- // Expected to be 510 (0x1FE), since only 255 nack ranges can fit.
- 0xFE, 0x01,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges (limited to 255 by size of this field).
- 0xFF,
- // {missing packet delta, further missing packets in range}
- // 6 nack ranges x 42 + 3 nack ranges
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- // 0 revived packets.
- 0x00,
- };
-
- scoped_ptr<QuicPacket> data(
- framer_.BuildDataPacket(header, frames, kMaxPacketSize).packet);
- ASSERT_TRUE(data != nullptr);
-
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
TEST_P(QuicFramerTest, BuildTruncatedAckFrameLargePacket) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
header.public_header.reset_flag = false;
@@ -3890,82 +3299,80 @@ TEST_P(QuicFramerTest, BuildTruncatedAckFrameLargePacket) {
frames.push_back(QuicFrame(&ack_frame));
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
- 0x74,
- // entropy hash of all received packets, set to 1 by TestEntropyCalculator
- // since ack is truncated.
- 0x01,
- // 2-byte largest observed packet sequence number.
- // Expected to be 510 (0x1FE), since only 255 nack ranges can fit.
- 0xFE, 0x01,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges (limited to 255 by size of this field).
- 0xFF,
- // {missing packet delta, further missing packets in range}
- // 6 nack ranges x 42 + 3 nack ranges
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-
- // 0 revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
+ 0x74,
+ // entropy hash of all received packets, set to 1 by TestEntropyCalculator
+ // since ack is truncated.
+ 0x01,
+ // 2-byte largest observed packet sequence number.
+ // Expected to be 510 (0x1FE), since only 255 nack ranges can fit.
+ 0xFE, 0x01,
+ // Zero delta time.
+ 0x00, 0x00,
+ // num missing packet ranges (limited to 255 by size of this field).
+ 0xFF,
+ // {missing packet delta, further missing packets in range}
+ // 6 nack ranges x 42 + 3 nack ranges
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+
+ // 0 revived packets.
+ 0x00,
};
scoped_ptr<QuicPacket> data(
@@ -3977,80 +3384,7 @@ TEST_P(QuicFramerTest, BuildTruncatedAckFrameLargePacket) {
AsChars(packet), arraysize(packet));
}
-
-TEST_P(QuicFramerTest, BuildTruncatedAckFrameSmallPacketv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = true;
- header.packet_sequence_number = GG_UINT64_C(0x770123456789AA8);
- header.fec_group = 0;
-
- QuicAckFrame ack_frame;
- // This entropy hash is different from what shows up in the packet below,
- // since entropy is recomputed by the framer on ack truncation (by
- // TestEntropyCalculator for this test.)
- ack_frame.entropy_hash = 0x43;
- ack_frame.largest_observed = 2 * 300;
- ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero();
- for (size_t i = 1; i < 2 * 300; i += 2) {
- ack_frame.missing_packets.insert(i);
- }
-
- QuicFrames frames;
- frames.push_back(QuicFrame(&ack_frame));
-
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
- 0x74,
- // entropy hash of all received packets, set to 1 by TestEntropyCalculator
- // since ack is truncated.
- 0x01,
- // 2-byte largest observed packet sequence number.
- // Expected to be 12 (0x0C), since only 6 nack ranges can fit.
- 0x0C, 0x00,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges (limited to 6 by packet size of 37).
- 0x06,
- // {missing packet delta, further missing packets in range}
- // 6 nack ranges
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- // 0 revived packets.
- 0x00,
- };
-
- scoped_ptr<QuicPacket> data(
- framer_.BuildDataPacket(header, frames, 37u).packet);
- ASSERT_TRUE(data != nullptr);
- // Expect 1 byte unused since at least 2 bytes are needed to fit more nacks.
- EXPECT_EQ(36u, data->length());
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
TEST_P(QuicFramerTest, BuildTruncatedAckFrameSmallPacket) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
header.public_header.reset_flag = false;
@@ -4075,35 +3409,33 @@ TEST_P(QuicFramerTest, BuildTruncatedAckFrameSmallPacket) {
frames.push_back(QuicFrame(&ack_frame));
unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xA8, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags (entropy)
- 0x01,
-
- // frame type (ack frame)
- // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
- 0x74,
- // entropy hash of all received packets, set to 1 by TestEntropyCalculator
- // since ack is truncated.
- 0x01,
- // 2-byte largest observed packet sequence number.
- // Expected to be 12 (0x0C), since only 6 nack ranges can fit.
- 0x0C, 0x00,
- // Zero delta time.
- 0x0, 0x0,
- // num missing packet ranges (limited to 6 by packet size of 37).
- 0x06,
- // {missing packet delta, further missing packets in range}
- // 6 nack ranges
- 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
- // 0 revived packets.
- 0x00,
+ // public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
+ // packet sequence number
+ 0xA8, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags (entropy)
+ 0x01,
+
+ // frame type (ack frame)
+ // (has nacks, is truncated, 2 byte largest observed, 1 byte delta)
+ 0x74,
+ // entropy hash of all received packets, set to 1 by TestEntropyCalculator
+ // since ack is truncated.
+ 0x01,
+ // 2-byte largest observed packet sequence number.
+ // Expected to be 12 (0x0C), since only 6 nack ranges can fit.
+ 0x0C, 0x00,
+ // Zero delta time.
+ 0x00, 0x00,
+ // num missing packet ranges (limited to 6 by packet size of 37).
+ 0x06,
+ // {missing packet delta, further missing packets in range}
+ // 6 nack ranges
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+ // 0 revived packets.
+ 0x00,
};
scoped_ptr<QuicPacket> data(
@@ -4116,51 +3448,6 @@ TEST_P(QuicFramerTest, BuildTruncatedAckFrameSmallPacket) {
AsChars(packet), arraysize(packet));
}
-TEST_P(QuicFramerTest, BuildCongestionFeedbackFramePacketTCP) {
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = false;
- header.packet_sequence_number = GG_UINT64_C(0x123456789ABC);
- header.fec_group = 0;
-
- QuicCongestionFeedbackFrame congestion_feedback_frame;
- congestion_feedback_frame.type = kTCP;
- congestion_feedback_frame.tcp.receive_window = 0x4030;
-
- QuicFrames frames;
- frames.push_back(QuicFrame(&congestion_feedback_frame));
-
- unsigned char packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags
- 0x00,
-
- // frame type (congestion feedback frame)
- 0x20,
- // congestion feedback type (TCP)
- 0x00,
- // TCP receive window
- 0x03, 0x04,
- };
-
- scoped_ptr<QuicPacket> data(BuildDataPacket(header, frames));
- ASSERT_TRUE(data != nullptr);
-
- test::CompareCharArraysWithHexError("constructed packet",
- data->data(), data->length(),
- AsChars(packet), arraysize(packet));
-}
-
TEST_P(QuicFramerTest, BuildStopWaitingPacket) {
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
@@ -4207,30 +3494,6 @@ TEST_P(QuicFramerTest, BuildStopWaitingPacket) {
AsChars(packet), arraysize(packet));
}
-TEST_P(QuicFramerTest, BuildCongestionFeedbackFramePacketInvalidFeedback) {
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = false;
- header.packet_sequence_number = GG_UINT64_C(0x123456789ABC);
- header.fec_group = 0;
-
- QuicCongestionFeedbackFrame congestion_feedback_frame;
- congestion_feedback_frame.type =
- static_cast<CongestionFeedbackType>(kTCP + 1);
-
- QuicFrames frames;
- frames.push_back(QuicFrame(&congestion_feedback_frame));
-
- scoped_ptr<QuicPacket> data;
- EXPECT_DFATAL(
- data.reset(BuildDataPacket(header, frames)),
- "AppendCongestionFeedbackFrame failed");
- ASSERT_TRUE(data == nullptr);
-}
-
TEST_P(QuicFramerTest, BuildRstFramePacketQuic) {
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
@@ -4768,54 +4031,7 @@ TEST_P(QuicFramerTest, AckTruncationLargePacket) {
EXPECT_EQ(509u, *last_missing_iter);
}
-TEST_P(QuicFramerTest, AckTruncationSmallPacketv22) {
- if (version_ > QUIC_VERSION_22) {
- return;
- }
- QuicPacketHeader header;
- header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
- header.public_header.reset_flag = false;
- header.public_header.version_flag = false;
- header.fec_flag = false;
- header.entropy_flag = false;
- header.packet_sequence_number = GG_UINT64_C(0x123456789ABC);
- header.fec_group = 0;
-
- // Create a packet with just the ack.
- QuicAckFrame ack_frame = MakeAckFrameWithNackRanges(300, 0u);
- QuicFrame frame;
- frame.type = ACK_FRAME;
- frame.ack_frame = &ack_frame;
- QuicFrames frames;
- frames.push_back(frame);
-
- // Build an ack packet with truncation due to limit in number of nack ranges.
- scoped_ptr<QuicPacket> raw_ack_packet(
- framer_.BuildDataPacket(header, frames, 500).packet);
- ASSERT_TRUE(raw_ack_packet != nullptr);
- scoped_ptr<QuicEncryptedPacket> ack_packet(
- framer_.EncryptPacket(ENCRYPTION_NONE, header.packet_sequence_number,
- *raw_ack_packet));
- // Now make sure we can turn our ack packet back into an ack frame.
- ASSERT_TRUE(framer_.ProcessPacket(*ack_packet));
- ASSERT_EQ(1u, visitor_.ack_frames_.size());
- QuicAckFrame& processed_ack_frame = *visitor_.ack_frames_[0];
- EXPECT_TRUE(processed_ack_frame.is_truncated);
- EXPECT_EQ(476u, processed_ack_frame.largest_observed);
- ASSERT_EQ(238u, processed_ack_frame.missing_packets.size());
- SequenceNumberSet::const_iterator missing_iter =
- processed_ack_frame.missing_packets.begin();
- EXPECT_EQ(1u, *missing_iter);
- SequenceNumberSet::const_reverse_iterator last_missing_iter =
- processed_ack_frame.missing_packets.rbegin();
- EXPECT_EQ(475u, *last_missing_iter);
-}
-
-
TEST_P(QuicFramerTest, AckTruncationSmallPacket) {
- if (version_ <= QUIC_VERSION_22) {
- return;
- }
QuicPacketHeader header;
header.public_header.connection_id = GG_UINT64_C(0xFEDCBA9876543210);
header.public_header.reset_flag = false;
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_headers_stream.h » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698