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

Side by Side Diff: net/quic/quic_packet_generator_test.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_packet_generator.h" 5 #include "net/quic/quic_packet_generator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "net/quic/crypto/crypto_protocol.h" 9 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/null_encrypter.h" 10 #include "net/quic/crypto/null_encrypter.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 CheckPacketContains(contents, packet2_); 553 CheckPacketContains(contents, packet2_);
554 } 554 }
555 555
556 TEST_F(QuicPacketGeneratorTest, FecGroupSizeOnCongestionWindowChange) { 556 TEST_F(QuicPacketGeneratorTest, FecGroupSizeOnCongestionWindowChange) {
557 delegate_.SetCanWriteAnything(); 557 delegate_.SetCanWriteAnything();
558 creator_->set_max_packets_per_fec_group(50); 558 creator_->set_max_packets_per_fec_group(50);
559 EXPECT_EQ(50u, creator_->max_packets_per_fec_group()); 559 EXPECT_EQ(50u, creator_->max_packets_per_fec_group());
560 EXPECT_FALSE(creator_->IsFecGroupOpen()); 560 EXPECT_FALSE(creator_->IsFecGroupOpen());
561 561
562 // On reduced cwnd. 562 // On reduced cwnd.
563 generator_.OnCongestionWindowChange(7 * kDefaultTCPMSS); 563 generator_.OnCongestionWindowChange(7);
564 EXPECT_EQ(3u, creator_->max_packets_per_fec_group()); 564 EXPECT_EQ(3u, creator_->max_packets_per_fec_group());
565 565
566 // On increased cwnd. 566 // On increased cwnd.
567 generator_.OnCongestionWindowChange(100 * kDefaultTCPMSS); 567 generator_.OnCongestionWindowChange(100);
568 EXPECT_EQ(50u, creator_->max_packets_per_fec_group()); 568 EXPECT_EQ(50u, creator_->max_packets_per_fec_group());
569 569
570 // On collapsed cwnd. 570 // On collapsed cwnd.
571 generator_.OnCongestionWindowChange(1 * kDefaultTCPMSS); 571 generator_.OnCongestionWindowChange(1);
572 EXPECT_EQ(2u, creator_->max_packets_per_fec_group()); 572 EXPECT_EQ(2u, creator_->max_packets_per_fec_group());
573 } 573 }
574 574
575 TEST_F(QuicPacketGeneratorTest, FecGroupSizeChangeWithOpenGroup) { 575 TEST_F(QuicPacketGeneratorTest, FecGroupSizeChangeWithOpenGroup) {
576 delegate_.SetCanWriteAnything(); 576 delegate_.SetCanWriteAnything();
577 // TODO(jri): This starting of batch mode should not be required when 577 // TODO(jri): This starting of batch mode should not be required when
578 // FEC sending is separated from batching operations. 578 // FEC sending is separated from batching operations.
579 generator_.StartBatchOperations(); 579 generator_.StartBatchOperations();
580 creator_->set_max_packets_per_fec_group(50); 580 creator_->set_max_packets_per_fec_group(50);
581 EXPECT_EQ(50u, creator_->max_packets_per_fec_group()); 581 EXPECT_EQ(50u, creator_->max_packets_per_fec_group());
(...skipping 10 matching lines...) Expand all
592 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( 592 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce(
593 SaveArg<0>(&packet3_)); 593 SaveArg<0>(&packet3_));
594 } 594 }
595 size_t data_len = 3 * kDefaultMaxPacketSize + 1; 595 size_t data_len = 3 * kDefaultMaxPacketSize + 1;
596 QuicConsumedData consumed = generator_.ConsumeData( 596 QuicConsumedData consumed = generator_.ConsumeData(
597 7, CreateData(data_len), 0, true, MUST_FEC_PROTECT, nullptr); 597 7, CreateData(data_len), 0, true, MUST_FEC_PROTECT, nullptr);
598 EXPECT_EQ(data_len, consumed.bytes_consumed); 598 EXPECT_EQ(data_len, consumed.bytes_consumed);
599 EXPECT_TRUE(creator_->IsFecGroupOpen()); 599 EXPECT_TRUE(creator_->IsFecGroupOpen());
600 600
601 // Change FEC groupsize. 601 // Change FEC groupsize.
602 generator_.OnCongestionWindowChange(2 * kDefaultTCPMSS); 602 generator_.OnCongestionWindowChange(2);
603 EXPECT_EQ(2u, creator_->max_packets_per_fec_group()); 603 EXPECT_EQ(2u, creator_->max_packets_per_fec_group());
604 604
605 // Send enough data to trigger one unprotected data packet, 605 // Send enough data to trigger one unprotected data packet,
606 // causing the FEC packet to also be sent. 606 // causing the FEC packet to also be sent.
607 { 607 {
608 InSequence dummy; 608 InSequence dummy;
609 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( 609 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce(
610 SaveArg<0>(&packet4_)); 610 SaveArg<0>(&packet4_));
611 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce( 611 EXPECT_CALL(delegate_, OnSerializedPacket(_)).WillOnce(
612 SaveArg<0>(&packet5_)); 612 SaveArg<0>(&packet5_));
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 generator_.SetConnectionIdLength(7); 971 generator_.SetConnectionIdLength(7);
972 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 972 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
973 generator_.SetConnectionIdLength(8); 973 generator_.SetConnectionIdLength(8);
974 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 974 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
975 generator_.SetConnectionIdLength(9); 975 generator_.SetConnectionIdLength(9);
976 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length()); 976 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, creator_->connection_id_length());
977 } 977 }
978 978
979 } // namespace test 979 } // namespace test
980 } // namespace net 980 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_generator.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698