gfe-relnote: In QUIC v48, support partial write of CRYPTO frames. Protected by existing gfe2_reloadable_flag_quic_enable_version_48.
PiperOrigin-RevId: 264373472
Change-Id: I285900280e459bbd70e519ec1e78dc2fa518e4c4
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 3a6db56..09d2bbb 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -2692,6 +2692,31 @@
EXPECT_TRUE(stream->write_side_closed());
}
+TEST_P(QuicSessionTestServer, WriteBufferedCryptoFrames) {
+ if (!QuicVersionUsesCryptoFrames(connection_->transport_version())) {
+ return;
+ }
+ std::string data(1350, 'a');
+ TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream();
+ // Only consumed 1000 bytes.
+ EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_INITIAL, 1350, 0))
+ .WillOnce(Return(1000));
+ crypto_stream->WriteCryptoData(ENCRYPTION_INITIAL, data);
+ EXPECT_TRUE(session_.HasPendingHandshake());
+ EXPECT_TRUE(session_.WillingAndAbleToWrite());
+
+ EXPECT_CALL(*connection_, SendCryptoData(_, _, _)).Times(0);
+ crypto_stream->WriteCryptoData(ENCRYPTION_ZERO_RTT, data);
+
+ EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_INITIAL, 350, 1000))
+ .WillOnce(Return(350));
+ EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_ZERO_RTT, 1350, 0))
+ .WillOnce(Return(1350));
+ session_.OnCanWrite();
+ EXPECT_FALSE(session_.HasPendingHandshake());
+ EXPECT_FALSE(session_.WillingAndAbleToWrite());
+}
+
} // namespace
} // namespace test
} // namespace quic