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

Side by Side Diff: net/quic/quic_connection_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_connection_stats.cc ('k') | net/quic/quic_dispatcher.cc » ('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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 .WillOnce(Return(lost_packets)); 3669 .WillOnce(Return(lost_packets));
3670 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 3670 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
3671 EXPECT_CALL(visitor_, OnCanWrite()).Times(2); 3671 EXPECT_CALL(visitor_, OnCanWrite()).Times(2);
3672 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 3672 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
3673 EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout()); 3673 EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
3674 ProcessAckPacket(&nack_three); 3674 ProcessAckPacket(&nack_three);
3675 3675
3676 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce( 3676 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce(
3677 Return(QuicBandwidth::Zero())); 3677 Return(QuicBandwidth::Zero()));
3678 3678
3679 const uint32 kSlowStartThreshold = 23u;
3680 EXPECT_CALL(*send_algorithm_, GetSlowStartThreshold()).WillOnce(
3681 Return(kSlowStartThreshold));
3682
3683 const QuicConnectionStats& stats = connection_.GetStats(); 3679 const QuicConnectionStats& stats = connection_.GetStats();
3684 EXPECT_EQ(3 * first_packet_size + 2 * second_packet_size - kQuicVersionSize, 3680 EXPECT_EQ(3 * first_packet_size + 2 * second_packet_size - kQuicVersionSize,
3685 stats.bytes_sent); 3681 stats.bytes_sent);
3686 EXPECT_EQ(5u, stats.packets_sent); 3682 EXPECT_EQ(5u, stats.packets_sent);
3687 EXPECT_EQ(2 * first_packet_size + second_packet_size - kQuicVersionSize, 3683 EXPECT_EQ(2 * first_packet_size + second_packet_size - kQuicVersionSize,
3688 stats.bytes_retransmitted); 3684 stats.bytes_retransmitted);
3689 EXPECT_EQ(3u, stats.packets_retransmitted); 3685 EXPECT_EQ(3u, stats.packets_retransmitted);
3690 EXPECT_EQ(1u, stats.rto_count); 3686 EXPECT_EQ(1u, stats.rto_count);
3691 EXPECT_EQ(kMaxPacketSize, stats.congestion_window);
3692 EXPECT_EQ(kSlowStartThreshold, stats.slow_start_threshold);
3693 EXPECT_EQ(kDefaultMaxPacketSize, stats.max_packet_size); 3687 EXPECT_EQ(kDefaultMaxPacketSize, stats.max_packet_size);
3694 } 3688 }
3695 3689
3696 TEST_P(QuicConnectionTest, CheckReceiveStats) { 3690 TEST_P(QuicConnectionTest, CheckReceiveStats) {
3697 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 3691 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
3698 3692
3699 size_t received_bytes = 0; 3693 size_t received_bytes = 0;
3700 received_bytes += ProcessFecProtectedPacket(1, false, !kEntropyFlag); 3694 received_bytes += ProcessFecProtectedPacket(1, false, !kEntropyFlag);
3701 received_bytes += ProcessFecProtectedPacket(3, false, !kEntropyFlag); 3695 received_bytes += ProcessFecProtectedPacket(3, false, !kEntropyFlag);
3702 // Should be counted against dropped packets. 3696 // Should be counted against dropped packets.
3703 received_bytes += ProcessDataPacket(3, 1, !kEntropyFlag); 3697 received_bytes += ProcessDataPacket(3, 1, !kEntropyFlag);
3704 received_bytes += ProcessFecPacket(4, 1, true, !kEntropyFlag, nullptr); 3698 received_bytes += ProcessFecPacket(4, 1, true, !kEntropyFlag, nullptr);
3705 3699
3706 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce( 3700 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce(
3707 Return(QuicBandwidth::Zero())); 3701 Return(QuicBandwidth::Zero()));
3708 const uint32 kSlowStartThreshold = 23u;
3709 EXPECT_CALL(*send_algorithm_, GetSlowStartThreshold()).WillOnce(
3710 Return(kSlowStartThreshold));
3711 3702
3712 const QuicConnectionStats& stats = connection_.GetStats(); 3703 const QuicConnectionStats& stats = connection_.GetStats();
3713 EXPECT_EQ(received_bytes, stats.bytes_received); 3704 EXPECT_EQ(received_bytes, stats.bytes_received);
3714 EXPECT_EQ(4u, stats.packets_received); 3705 EXPECT_EQ(4u, stats.packets_received);
3715 3706
3716 EXPECT_EQ(1u, stats.packets_revived); 3707 EXPECT_EQ(1u, stats.packets_revived);
3717 EXPECT_EQ(1u, stats.packets_dropped); 3708 EXPECT_EQ(1u, stats.packets_dropped);
3718
3719 EXPECT_EQ(kSlowStartThreshold, stats.slow_start_threshold);
3720 } 3709 }
3721 3710
3722 TEST_P(QuicConnectionTest, TestFecGroupLimits) { 3711 TEST_P(QuicConnectionTest, TestFecGroupLimits) {
3723 // Create and return a group for 1. 3712 // Create and return a group for 1.
3724 ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 1) != nullptr); 3713 ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 1) != nullptr);
3725 3714
3726 // Create and return a group for 2. 3715 // Create and return a group for 2.
3727 ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 2) != nullptr); 3716 ASSERT_TRUE(QuicConnectionPeer::GetFecGroup(&connection_, 2) != nullptr);
3728 3717
3729 // Create and return a group for 4. This should remove 1 but not 2. 3718 // Create and return a group for 4. This should remove 1 but not 2.
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
4166 QuicBlockedFrame blocked; 4155 QuicBlockedFrame blocked;
4167 blocked.stream_id = 3; 4156 blocked.stream_id = 3;
4168 EXPECT_CALL(visitor_, OnBlockedFrames(_)); 4157 EXPECT_CALL(visitor_, OnBlockedFrames(_));
4169 ProcessFramePacket(QuicFrame(&blocked)); 4158 ProcessFramePacket(QuicFrame(&blocked));
4170 EXPECT_TRUE(ack_alarm->IsSet()); 4159 EXPECT_TRUE(ack_alarm->IsSet());
4171 } 4160 }
4172 4161
4173 } // namespace 4162 } // namespace
4174 } // namespace test 4163 } // namespace test
4175 } // namespace net 4164 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_stats.cc ('k') | net/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698