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

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

Issue 76723002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_received_packet_manager.cc ('k') | net/quic/quic_reliable_client_stream_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_received_packet_manager.h" 5 #include "net/quic/quic_received_packet_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/quic/test_tools/quic_received_packet_manager_peer.h" 10 #include "net/quic/test_tools/quic_received_packet_manager_peer.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 header.packet_sequence_number = 7u; 107 header.packet_sequence_number = 7u;
108 received_manager_.RecordPacketReceived(header, QuicTime::Zero()); 108 received_manager_.RecordPacketReceived(header, QuicTime::Zero());
109 EXPECT_TRUE(received_manager_.IsAwaitingPacket(3u)); 109 EXPECT_TRUE(received_manager_.IsAwaitingPacket(3u));
110 EXPECT_TRUE(received_manager_.IsAwaitingPacket(6u)); 110 EXPECT_TRUE(received_manager_.IsAwaitingPacket(6u));
111 EXPECT_TRUE(QuicReceivedPacketManagerPeer::DontWaitForPacketsBefore( 111 EXPECT_TRUE(QuicReceivedPacketManagerPeer::DontWaitForPacketsBefore(
112 &received_manager_, 4)); 112 &received_manager_, 4));
113 EXPECT_FALSE(received_manager_.IsAwaitingPacket(3u)); 113 EXPECT_FALSE(received_manager_.IsAwaitingPacket(3u));
114 EXPECT_TRUE(received_manager_.IsAwaitingPacket(6u)); 114 EXPECT_TRUE(received_manager_.IsAwaitingPacket(6u));
115 } 115 }
116 116
117 TEST_F(QuicReceivedPacketManagerTest, UpdateReceivedPacketInfo) {
118 QuicPacketHeader header;
119 header.packet_sequence_number = 2u;
120 QuicTime two_ms = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(2));
121 received_manager_.RecordPacketReceived(header, two_ms);
122
123 ReceivedPacketInfo info;
124 received_manager_.UpdateReceivedPacketInfo(&info, QuicTime::Zero());
125 // When UpdateReceivedPacketInfo with a time earlier than the time of the
126 // largest observed packet, make sure that the delta is 0, not negative.
127 EXPECT_EQ(QuicTime::Delta::Zero(), info.delta_time_largest_observed);
128
129 QuicTime four_ms = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(4));
130 received_manager_.UpdateReceivedPacketInfo(&info, four_ms);
131 // When UpdateReceivedPacketInfo after not having received a new packet,
132 // the delta should still be accurate.
133 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(2),
134 info.delta_time_largest_observed);
135 }
136
117 } // namespace 137 } // namespace
118 } // namespace test 138 } // namespace test
119 } // namespace net 139 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_received_packet_manager.cc ('k') | net/quic/quic_reliable_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698