blob: 54029d0d2206cb257e61a3595ff70e70f8cd23cb [file] [log] [blame]
Sebastian Jansson3525f862019-05-17 17:44:04 +02001/*
2 * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "api/transport/test/create_feedback_generator.h"
12#include "test/gtest.h"
13
14namespace webrtc {
15TEST(FeedbackGeneratorTest, ReportsFeedbackForSentPackets) {
16 size_t kPacketSize = 1000;
17 auto gen = CreateFeedbackGenerator(FeedbackGenerator::Config());
18 for (int i = 0; i < 10; ++i) {
19 gen->SendPacket(kPacketSize);
20 gen->Sleep(TimeDelta::ms(50));
21 }
22 auto feedback_list = gen->PopFeedback();
23 EXPECT_GT(feedback_list.size(), 0u);
24 for (const auto& feedback : feedback_list) {
25 EXPECT_GT(feedback.packet_feedbacks.size(), 0u);
26 for (const auto& packet : feedback.packet_feedbacks) {
27 EXPECT_EQ(packet.sent_packet.size.bytes<size_t>(), kPacketSize);
28 }
29 }
30}
31} // namespace webrtc