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

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

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 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_protocol.cc ('k') | net/quic/quic_session.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_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 namespace test { 11 namespace test {
12 namespace { 12 namespace {
13 13
14 TEST(QuicProtocolTest, ReceivedInfo_RecordReceived) { 14 TEST(QuicProtocolTest, IsAawaitingPacket) {
15 ReceivedPacketInfo received_info; 15 ReceivedPacketInfo received_info;
16 received_info.RecordReceived(1u); 16 received_info.largest_observed = 10u;
17 EXPECT_TRUE(IsAwaitingPacket(received_info, 11u));
18 EXPECT_FALSE(IsAwaitingPacket(received_info, 1u));
17 19
18 EXPECT_EQ(1u, received_info.largest_observed); 20 received_info.missing_packets.insert(10);
19 EXPECT_EQ(0u, received_info.missing_packets.size()); 21 EXPECT_TRUE(IsAwaitingPacket(received_info, 10u));
20
21 received_info.RecordReceived(3u);
22
23 EXPECT_EQ(3u, received_info.largest_observed);
24 EXPECT_EQ(1u, received_info.missing_packets.size());
25
26 received_info.RecordReceived(2u);
27
28 EXPECT_EQ(3u, received_info.largest_observed);
29 EXPECT_EQ(0u, received_info.missing_packets.size());
30 } 22 }
31 23
32 TEST(QuicProtocolTest, ReceivedInfo_ClearMissingBefore) { 24 TEST(QuicProtocolTest, InsertMissingPacketsBetween) {
33 ReceivedPacketInfo received_info; 25 ReceivedPacketInfo received_info;
34 received_info.RecordReceived(1u); 26 InsertMissingPacketsBetween(&received_info, 4u, 10u);
27 EXPECT_EQ(6u, received_info.missing_packets.size());
35 28
36 // Clear nothing. 29 QuicPacketSequenceNumber i = 4;
37 received_info.ClearMissingBefore(1); 30 for (SequenceNumberSet::iterator it = received_info.missing_packets.begin();
38 EXPECT_EQ(0u, received_info.missing_packets.size()); 31 it != received_info.missing_packets.end(); ++it, ++i) {
39 32 EXPECT_EQ(i, *it);
40 received_info.RecordReceived(3u); 33 }
41
42 // Clear the first packet.
43 received_info.ClearMissingBefore(2);
44 EXPECT_EQ(1u, received_info.missing_packets.size());
45
46 // Clear the second packet, which has not been received.
47 received_info.ClearMissingBefore(3);
48 EXPECT_EQ(0u, received_info.missing_packets.size());
49 } 34 }
50 35
51 } // namespace 36 } // namespace
52 } // namespace test 37 } // namespace test
53 } // namespace net 38 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698