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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 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/quic_connection.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 54b6dd00220c2584d3f2133310d88d0cb358a89f..27dcedb9379c50d1078d00b633c9a7692bb8395d 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -141,6 +141,15 @@ class TaggingDecrypter : public QuicDecrypter {
bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; }
+ bool SetPreliminaryKey(StringPiece key) override {
+ QUIC_BUG << "should not be called";
+ return false;
+ }
+
+ bool SetDiversificationNonce(DiversificationNonce key) override {
+ return true;
+ }
+
bool DecryptPacket(QuicPathId path_id,
QuicPacketNumber packet_number,
StringPiece associated_data,
@@ -3430,7 +3439,8 @@ TEST_P(QuicConnectionTest, TestQueueLimitsOnSendStreamData) {
size_t payload_length;
size_t length = GetPacketLengthForOneStream(
connection_.version(), kIncludeVersion, !kIncludePathId,
- PACKET_8BYTE_CONNECTION_ID, PACKET_1BYTE_PACKET_NUMBER, &payload_length);
+ !kIncludeDiversificationNonce, PACKET_8BYTE_CONNECTION_ID,
+ PACKET_1BYTE_PACKET_NUMBER, &payload_length);
connection_.SetMaxPacketLength(length);
// Queue the first packet.
@@ -3451,10 +3461,11 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPackets) {
// offset 0, and 2 for non-zero offsets up through 16K. Increase
// max_packet_length by 2 so that subsequent packets containing subsequent
// stream frames with non-zero offets will fit within the packet length.
- size_t length = 2 + GetPacketLengthForOneStream(
- connection_.version(), kIncludeVersion,
- !kIncludePathId, PACKET_8BYTE_CONNECTION_ID,
- PACKET_1BYTE_PACKET_NUMBER, &payload_length);
+ size_t length =
+ 2 + GetPacketLengthForOneStream(
+ connection_.version(), kIncludeVersion, !kIncludePathId,
+ !kIncludeDiversificationNonce, PACKET_8BYTE_CONNECTION_ID,
+ PACKET_1BYTE_PACKET_NUMBER, &payload_length);
connection_.SetMaxPacketLength(length);
// Queue the first packet.
@@ -3480,30 +3491,8 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
// we see in this test, due to the non-truncated connection id.
size_t non_truncated_packet_size = writer_->last_packet_size();
- // Change to a 4 byte connection id.
- QuicConfig config;
- QuicConfigPeer::SetReceivedBytesForConnectionId(&config, 4);
- connection_.SetFromConfig(config);
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
- .bytes_consumed);
- // Verify that we have 8 fewer bytes than in the non-truncated case. The
- // first packet got 4 bytes of extra payload due to the truncation, and the
- // headers here are also 4 byte smaller.
- EXPECT_EQ(non_truncated_packet_size, writer_->last_packet_size() + 8);
-
- // Change to a 1 byte connection id.
- QuicConfigPeer::SetReceivedBytesForConnectionId(&config, 1);
- connection_.SetFromConfig(config);
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
- .bytes_consumed);
- // Just like above, we save 7 bytes on payload, and 7 on truncation.
- EXPECT_EQ(non_truncated_packet_size, writer_->last_packet_size() + 7 * 2);
-
// Change to a 0 byte connection id.
+ QuicConfig config;
QuicConfigPeer::SetReceivedBytesForConnectionId(&config, 0);
connection_.SetFromConfig(config);
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698