chromium/net/third_party/quiche/src/quiche/quic/test_tools/packet_dropping_test_writer.cc

// Copyright 2013 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 "quiche/quic/test_tools/packet_dropping_test_writer.h"

#include <memory>
#include <utility>

#include "quiche/quic/platform/api/quic_logging.h"

namespace quic {
namespace test {

// Every dropped packet must be followed by this number of succesfully written
// packets. This is to avoid flaky test failures and timeouts, for example, in
// case both the client and the server drop every other packet (which is
// statistically possible even if drop percentage is less than 50%).
const int32_t kMinSuccesfulWritesAfterPacketLoss =;

// An alarm that is scheduled if a blocked socket is simulated to indicate
// it's writable again.
class WriteUnblockedAlarm : public QuicAlarm::DelegateWithoutContext {};

// An alarm that is scheduled every time a new packet is to be written at a
// later point.
class DelayAlarm : public QuicAlarm::DelegateWithoutContext {};

PacketDroppingTestWriter::PacketDroppingTestWriter()
    :{}

PacketDroppingTestWriter::~PacketDroppingTestWriter() {}

void PacketDroppingTestWriter::Initialize(
    QuicConnectionHelperInterface* helper, QuicAlarmFactory* alarm_factory,
    std::unique_ptr<Delegate> on_can_write) {}

WriteResult PacketDroppingTestWriter::WritePacket(
    const char* buffer, size_t buf_len, const QuicIpAddress& self_address,
    const QuicSocketAddress& peer_address, PerPacketOptions* options,
    const QuicPacketWriterParams& params) {}

bool PacketDroppingTestWriter::IsWriteBlocked() const {}

void PacketDroppingTestWriter::SetWritable() {}

QuicTime PacketDroppingTestWriter::ReleaseNextPacket() {}

QuicTime PacketDroppingTestWriter::ReleaseOldPackets() {}

void PacketDroppingTestWriter::SetDelayAlarm(QuicTime new_deadline) {}

void PacketDroppingTestWriter::OnCanWrite() {}

PacketDroppingTestWriter::DelayedWrite::DelayedWrite(
    const char* buffer, size_t buf_len, const QuicIpAddress& self_address,
    const QuicSocketAddress& peer_address,
    std::unique_ptr<PerPacketOptions> options,
    const QuicPacketWriterParams& params, QuicTime send_time)
    :{}

PacketDroppingTestWriter::DelayedWrite::~DelayedWrite() = default;

}  // namespace test
}  // namespace quic