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

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

Issue 2962043002: The Remove functions in quic_ack_frame.cc are renamed RemoveTestOnly. (Closed)
Patch Set: Rebase Created 3 years, 5 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
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/core/quic_connection.h" 5 #include "net/quic/core/quic_connection.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <memory> 8 #include <memory>
9 #include <ostream> 9 #include <ostream>
10 #include <utility> 10 #include <utility>
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1004
1005 const QuicStopWaitingFrame InitStopWaitingFrame( 1005 const QuicStopWaitingFrame InitStopWaitingFrame(
1006 QuicPacketNumber least_unacked) { 1006 QuicPacketNumber least_unacked) {
1007 QuicStopWaitingFrame frame; 1007 QuicStopWaitingFrame frame;
1008 frame.least_unacked = least_unacked; 1008 frame.least_unacked = least_unacked;
1009 return frame; 1009 return frame;
1010 } 1010 }
1011 1011
1012 // Explicitly nack a packet. 1012 // Explicitly nack a packet.
1013 void NackPacket(QuicPacketNumber missing, QuicAckFrame* frame) { 1013 void NackPacket(QuicPacketNumber missing, QuicAckFrame* frame) {
1014 frame->packets.Remove(missing); 1014 frame->packets.RemoveTestOnly(missing);
1015 } 1015 }
1016 1016
1017 // Undo nacking a packet within the frame. 1017 // Undo nacking a packet within the frame.
1018 void AckPacket(QuicPacketNumber arrived, QuicAckFrame* frame) { 1018 void AckPacket(QuicPacketNumber arrived, QuicAckFrame* frame) {
1019 EXPECT_FALSE(frame->packets.Contains(arrived)); 1019 EXPECT_FALSE(frame->packets.Contains(arrived));
1020 frame->packets.Add(arrived); 1020 frame->packets.Add(arrived);
1021 } 1021 }
1022 1022
1023 void TriggerConnectionClose() { 1023 void TriggerConnectionClose() {
1024 // Send an erroneous packet to close the connection. 1024 // Send an erroneous packet to close the connection.
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 EXPECT_EQ(8u, last_packet); 1752 EXPECT_EQ(8u, last_packet);
1753 SendAckPacketToPeer(); // Packet 9 1753 SendAckPacketToPeer(); // Packet 9
1754 if (GetParam().no_stop_waiting) { 1754 if (GetParam().no_stop_waiting) {
1755 // Expect no stop waiting frame is sent. 1755 // Expect no stop waiting frame is sent.
1756 EXPECT_EQ(0u, least_unacked()); 1756 EXPECT_EQ(0u, least_unacked());
1757 } else { 1757 } else {
1758 EXPECT_EQ(7u, least_unacked()); 1758 EXPECT_EQ(7u, least_unacked());
1759 } 1759 }
1760 } 1760 }
1761 1761
1762 // QuicConnection should record the the packet sent-time prior to sending the 1762 // QuicConnection should record the packet sent-time prior to sending the
1763 // packet. 1763 // packet.
1764 TEST_P(QuicConnectionTest, RecordSentTimeBeforePacketSent) { 1764 TEST_P(QuicConnectionTest, RecordSentTimeBeforePacketSent) {
1765 // We're using a MockClock for the tests, so we have complete control over the 1765 // We're using a MockClock for the tests, so we have complete control over the
1766 // time. 1766 // time.
1767 // Our recorded timestamp for the last packet sent time will be passed in to 1767 // Our recorded timestamp for the last packet sent time will be passed in to
1768 // the send_algorithm. Make sure that it is set to the correct value. 1768 // the send_algorithm. Make sure that it is set to the correct value.
1769 QuicTime actual_recorded_send_time = QuicTime::Zero(); 1769 QuicTime actual_recorded_send_time = QuicTime::Zero();
1770 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 1770 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
1771 .WillOnce(DoAll(SaveArg<0>(&actual_recorded_send_time), Return(true))); 1771 .WillOnce(DoAll(SaveArg<0>(&actual_recorded_send_time), Return(true)));
1772 1772
(...skipping 3480 matching lines...) Expand 10 before | Expand all | Expand 10 after
5253 error_details, ConnectionCloseSource::FROM_PEER)); 5253 error_details, ConnectionCloseSource::FROM_PEER));
5254 connection_.set_perspective(Perspective::IS_CLIENT); 5254 connection_.set_perspective(Perspective::IS_CLIENT);
5255 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, 5255 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT,
5256 error_details, 5256 error_details,
5257 ConnectionCloseBehavior::SILENT_CLOSE); 5257 ConnectionCloseBehavior::SILENT_CLOSE);
5258 } 5258 }
5259 5259
5260 } // namespace 5260 } // namespace
5261 } // namespace test 5261 } // namespace test
5262 } // namespace net 5262 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/frames/quic_frames_test.cc ('k') | net/quic/core/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698