blob: 5bb12f49ab425abede3d7a2f8c4e5226e85077d5 (
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
|
// 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 "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "net/quic/congestion_control/tcp_receiver.h"
#include "net/quic/test_tools/mock_clock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace test {
class QuicTcpReceiverTest : public ::testing::Test {
protected:
void SetUp() {
receiver_.reset(new TcpReceiver());
}
scoped_ptr<TcpReceiver> receiver_;
};
TEST_F(QuicTcpReceiverTest, SimpleReceiver) {
QuicCongestionFeedbackFrame feedback;
QuicTime timestamp(QuicTime::Zero());
receiver_->RecordIncomingPacket(1, 1, timestamp, false);
ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
EXPECT_EQ(kTCP, feedback.type);
EXPECT_EQ(256000u, feedback.tcp.receive_window);
EXPECT_EQ(0, feedback.tcp.accumulated_number_of_lost_packets);
receiver_->RecordIncomingPacket(1, 2, timestamp, true);
ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
EXPECT_EQ(kTCP, feedback.type);
EXPECT_EQ(256000u, feedback.tcp.receive_window);
EXPECT_EQ(1, feedback.tcp.accumulated_number_of_lost_packets);
}
} // namespace test
} // namespace net
|