blob: a77582f91be4514ffd0310964f650afb8dff2784 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/quic/quic_protocol.h"
#include "base/stl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace test {
namespace {
TEST(QuicProtocolTest, ReceivedInfo_RecordReceived) {
ReceivedPacketInfo received_info;
received_info.RecordReceived(1u);
EXPECT_EQ(1u, received_info.largest_observed);
EXPECT_EQ(0u, received_info.missing_packets.size());
received_info.RecordReceived(3u);
EXPECT_EQ(3u, received_info.largest_observed);
EXPECT_EQ(1u, received_info.missing_packets.size());
received_info.RecordReceived(2u);
EXPECT_EQ(3u, received_info.largest_observed);
EXPECT_EQ(0u, received_info.missing_packets.size());
}
TEST(QuicProtocolTest, ReceivedInfo_ClearMissingBefore) {
ReceivedPacketInfo received_info;
received_info.RecordReceived(1u);
// Clear nothing.
received_info.ClearMissingBefore(1);
EXPECT_EQ(0u, received_info.missing_packets.size());
received_info.RecordReceived(3u);
// Clear the first packet.
received_info.ClearMissingBefore(2);
EXPECT_EQ(1u, received_info.missing_packets.size());
// Clear the second packet, which has not been received.
received_info.ClearMissingBefore(3);
EXPECT_EQ(0u, received_info.missing_packets.size());
}
} // namespace
} // namespace test
} // namespace net
|