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

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

Issue 157403006: Add QUIC_VERSION_15 to add a revived_packets set to replace the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_framer.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_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 631
632 void ProcessClosePacket(QuicPacketSequenceNumber number, 632 void ProcessClosePacket(QuicPacketSequenceNumber number,
633 QuicFecGroupNumber fec_group) { 633 QuicFecGroupNumber fec_group) {
634 scoped_ptr<QuicPacket> packet(ConstructClosePacket(number, fec_group)); 634 scoped_ptr<QuicPacket> packet(ConstructClosePacket(number, fec_group));
635 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket( 635 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(
636 ENCRYPTION_NONE, number, *packet)); 636 ENCRYPTION_NONE, number, *packet));
637 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted); 637 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted);
638 } 638 }
639 639
640 size_t ProcessFecProtectedPacket(QuicPacketSequenceNumber number, 640 size_t ProcessFecProtectedPacket(QuicPacketSequenceNumber number,
641 bool expect_revival, bool entropy_flag) { 641 bool expect_revival, bool entropy_flag) {
642 if (expect_revival) { 642 if (expect_revival) {
643 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillOnce(Return(accept_packet_)); 643 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillOnce(Return(accept_packet_));
644 } 644 }
645 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillOnce(Return(accept_packet_)) 645 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillOnce(Return(accept_packet_))
646 .RetiresOnSaturation(); 646 .RetiresOnSaturation();
647 return ProcessDataPacket(number, 1, entropy_flag); 647 return ProcessDataPacket(number, 1, entropy_flag);
648 } 648 }
649 649
650 // Processes an FEC packet that covers the packets that would have been 650 // Processes an FEC packet that covers the packets that would have been
651 // received. 651 // received.
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 TEST_F(QuicConnectionTest, ReceivedEntropyHashCalculation) { 2778 TEST_F(QuicConnectionTest, ReceivedEntropyHashCalculation) {
2779 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillRepeatedly(Return(true)); 2779 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillRepeatedly(Return(true));
2780 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 2780 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
2781 ProcessDataPacket(1, 1, kEntropyFlag); 2781 ProcessDataPacket(1, 1, kEntropyFlag);
2782 ProcessDataPacket(4, 1, kEntropyFlag); 2782 ProcessDataPacket(4, 1, kEntropyFlag);
2783 ProcessDataPacket(3, 1, !kEntropyFlag); 2783 ProcessDataPacket(3, 1, !kEntropyFlag);
2784 ProcessDataPacket(7, 1, kEntropyFlag); 2784 ProcessDataPacket(7, 1, kEntropyFlag);
2785 EXPECT_EQ(146u, outgoing_ack()->received_info.entropy_hash); 2785 EXPECT_EQ(146u, outgoing_ack()->received_info.entropy_hash);
2786 } 2786 }
2787 2787
2788 TEST_F(QuicConnectionTest, ReceivedEntropyHashCalculationHalfFEC) {
2789 // FEC packets should not change the entropy hash calculation.
2790 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillRepeatedly(Return(true));
2791 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
2792 ProcessDataPacket(1, 1, kEntropyFlag);
2793 ProcessFecPacket(4, 1, false, kEntropyFlag, NULL);
2794 ProcessDataPacket(3, 3, !kEntropyFlag);
2795 ProcessFecPacket(7, 3, false, kEntropyFlag, NULL);
2796 EXPECT_EQ(146u, outgoing_ack()->received_info.entropy_hash);
2797 }
2798
2788 TEST_F(QuicConnectionTest, UpdateEntropyForReceivedPackets) { 2799 TEST_F(QuicConnectionTest, UpdateEntropyForReceivedPackets) {
2789 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillRepeatedly(Return(true)); 2800 EXPECT_CALL(visitor_, OnStreamFrames(_)).WillRepeatedly(Return(true));
2790 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 2801 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
2791 ProcessDataPacket(1, 1, kEntropyFlag); 2802 ProcessDataPacket(1, 1, kEntropyFlag);
2792 ProcessDataPacket(5, 1, kEntropyFlag); 2803 ProcessDataPacket(5, 1, kEntropyFlag);
2793 ProcessDataPacket(4, 1, !kEntropyFlag); 2804 ProcessDataPacket(4, 1, !kEntropyFlag);
2794 EXPECT_EQ(34u, outgoing_ack()->received_info.entropy_hash); 2805 EXPECT_EQ(34u, outgoing_ack()->received_info.entropy_hash);
2795 // Make 4th packet my least unacked, and update entropy for 2, 3 packets. 2806 // Make 4th packet my least unacked, and update entropy for 2, 3 packets.
2796 QuicAckFrame ack = InitAckFrame(0, 4); 2807 QuicAckFrame ack = InitAckFrame(0, 4);
2797 QuicPacketEntropyHash kRandomEntropyHash = 129u; 2808 QuicPacketEntropyHash kRandomEntropyHash = 129u;
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
3467 true); 3478 true);
3468 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), 3479 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(),
3469 false); 3480 false);
3470 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); 3481 EXPECT_TRUE(client.sent_packet_manager().using_pacing());
3471 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); 3482 EXPECT_FALSE(server.sent_packet_manager().using_pacing());
3472 } 3483 }
3473 3484
3474 } // namespace 3485 } // namespace
3475 } // namespace test 3486 } // namespace test
3476 } // namespace net 3487 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698