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

Unified Diff: net/quic/core/quic_connection_test.cc

Issue 2828543002: Let QUIC be able to add random padding of [1,256] bytes after fin is consumed for a stream. Random … (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_connection_test.cc
diff --git a/net/quic/core/quic_connection_test.cc b/net/quic/core/quic_connection_test.cc
index 144f6744650cd40528db1d7202c704ff1ae64264..b4c6ba81208a16e058ebe7a8c1f9aca2ce181e0e 100644
--- a/net/quic/core/quic_connection_test.cc
+++ b/net/quic/core/quic_connection_test.cc
@@ -390,6 +390,10 @@ class TestPacketWriter : public QuicPacketWriter {
return framer_.ping_frames();
}
+ const std::vector<QuicPaddingFrame>& padding_frames() const {
+ return framer_.padding_frames();
+ }
+
size_t last_packet_size() { return last_packet_size_; }
const QuicVersionNegotiationPacket* version_negotiation_packet() {
@@ -1776,8 +1780,9 @@ TEST_P(QuicConnectionTest, FramePackingNonCryptoThenCrypto) {
EXPECT_FALSE(connection_.HasQueuedData());
// Parse the last packet and ensure it's the crypto stream frame.
- EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_EQ(2u, writer_->frame_count());
ASSERT_EQ(1u, writer_->stream_frames().size());
+ ASSERT_EQ(1u, writer_->padding_frames().size());
EXPECT_EQ(kCryptoStreamId, writer_->stream_frames()[0]->stream_id);
}
@@ -1854,8 +1859,9 @@ TEST_P(QuicConnectionTest, FramePackingSendv) {
// Parse the last packet and ensure multiple iovector blocks have
// been packed into a single stream frame from one stream.
- EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_EQ(2u, writer_->frame_count());
EXPECT_EQ(1u, writer_->stream_frames().size());
+ EXPECT_EQ(1u, writer_->padding_frames().size());
QuicStreamFrame* frame = writer_->stream_frames()[0].get();
EXPECT_EQ(1u, frame->stream_id);
EXPECT_EQ("ABCD", QuicStringPiece(frame->data_buffer, frame->data_length));
@@ -1883,8 +1889,9 @@ TEST_P(QuicConnectionTest, FramePackingSendvQueued) {
EXPECT_EQ(0u, connection_.NumQueuedPackets());
// Parse the last packet and ensure it's one stream frame from one stream.
- EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_EQ(2u, writer_->frame_count());
EXPECT_EQ(1u, writer_->stream_frames().size());
+ EXPECT_EQ(1u, writer_->padding_frames().size());
EXPECT_EQ(1u, writer_->stream_frames()[0]->stream_id);
}
@@ -4175,10 +4182,10 @@ TEST_P(QuicConnectionTest, SendDelayedAckOnOutgoingCryptoPacket) {
nullptr);
// Check that ack is bundled with outgoing crypto data.
if (GetParam().no_stop_waiting) {
- EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_EQ(3u, writer_->frame_count());
EXPECT_TRUE(writer_->stop_waiting_frames().empty());
} else {
- EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_EQ(4u, writer_->frame_count());
EXPECT_FALSE(writer_->stop_waiting_frames().empty());
}
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
@@ -4211,13 +4218,14 @@ TEST_P(QuicConnectionTest, BundleAckForSecondCHLO) {
ProcessPacket(2);
// Check that ack is sent and that delayed ack alarm is reset.
if (GetParam().no_stop_waiting) {
- EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_EQ(3u, writer_->frame_count());
EXPECT_TRUE(writer_->stop_waiting_frames().empty());
} else {
- EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_EQ(4u, writer_->frame_count());
EXPECT_FALSE(writer_->stop_waiting_frames().empty());
}
EXPECT_EQ(1u, writer_->stream_frames().size());
+ EXPECT_EQ(1u, writer_->padding_frames().size());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_EQ(2u, writer_->ack_frames().front().largest_observed);
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
@@ -4239,13 +4247,14 @@ TEST_P(QuicConnectionTest, BundleAckForSecondCHLOTwoPacketReject) {
}
// Check that ack is sent and that delayed ack alarm is reset.
if (GetParam().no_stop_waiting) {
- EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_EQ(3u, writer_->frame_count());
EXPECT_TRUE(writer_->stop_waiting_frames().empty());
} else {
- EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_EQ(4u, writer_->frame_count());
EXPECT_FALSE(writer_->stop_waiting_frames().empty());
}
EXPECT_EQ(1u, writer_->stream_frames().size());
+ EXPECT_EQ(1u, writer_->padding_frames().size());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_EQ(2u, writer_->ack_frames().front().largest_observed);
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698