chromium/net/third_party/quiche/src/quiche/quic/core/io/quic_all_event_loops_test.cc

// Copyright 2022 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.

// A universal test for all event loops supported by the build of QUICHE in
// question.
//
// This test is very similar to QuicPollEventLoopTest, however, there are some
// notable differences:
//   (1) This test uses the real clock, since the event loop implementation may
//       not support accepting a mock clock.
//   (2) This test covers both level-triggered and edge-triggered event loops.

#include <fcntl.h>
#include <unistd.h>

#include <memory>
#include <string>
#include <utility>

#include "absl/cleanup/cleanup.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/io/quic_default_event_loop.h"
#include "quiche/quic/core/io/quic_event_loop.h"
#include "quiche/quic/core/quic_alarm.h"
#include "quiche/quic/core/quic_alarm_factory.h"
#include "quiche/quic/core/quic_default_clock.h"
#include "quiche/quic/core/quic_time.h"
#include "quiche/quic/platform/api/quic_test.h"
#include "quiche/quic/test_tools/quic_test_utils.h"

namespace quic::test {
namespace {

_;
AtMost;

MATCHER_P(HasFlagSet, value, "Checks a flag in a bit mask") {}

constexpr QuicSocketEventMask kAllEvents =;

class MockQuicSocketEventListener : public QuicSocketEventListener {};

class MockDelegate : public QuicAlarm::Delegate {};

void SetNonBlocking(int fd) {}

class QuicEventLoopFactoryTest
    : public QuicTestWithParam<QuicEventLoopFactory*> {};

std::string GetTestParamName(
    ::testing::TestParamInfo<QuicEventLoopFactory*> info) {}

INSTANTIATE_TEST_SUITE_P();

TEST_P(QuicEventLoopFactoryTest, NothingHappens) {}

TEST_P(QuicEventLoopFactoryTest, RearmWriter) {}

TEST_P(QuicEventLoopFactoryTest, Readable) {}

// A common pattern: read a limited amount of data from an FD, and expect to
// read the remainder on the next operation.
TEST_P(QuicEventLoopFactoryTest, ArtificialNotifyFromCallback) {}

// Verify that artificial events are notified on the next iteration. This is to
// prevent infinite loops in RunEventLoopOnce when the event callback keeps
// adding artificial events.
TEST_P(QuicEventLoopFactoryTest, ArtificialNotifyOncePerIteration) {}

TEST_P(QuicEventLoopFactoryTest, WriterUnblocked) {}

TEST_P(QuicEventLoopFactoryTest, ArtificialEvent) {}

TEST_P(QuicEventLoopFactoryTest, Unregister) {}

TEST_P(QuicEventLoopFactoryTest, UnregisterInsideEventHandler) {}

TEST_P(QuicEventLoopFactoryTest, UnregisterSelfInsideEventHandler) {}

// Creates a bidirectional socket and tests its behavior when it's both readable
// and writable.
TEST_P(QuicEventLoopFactoryTest, ReadWriteSocket) {}

TEST_P(QuicEventLoopFactoryTest, AlarmInFuture) {}

TEST_P(QuicEventLoopFactoryTest, AlarmsInPast) {}

TEST_P(QuicEventLoopFactoryTest, AlarmCancelled) {}

TEST_P(QuicEventLoopFactoryTest, AlarmCancelledAndSetAgain) {}

TEST_P(QuicEventLoopFactoryTest, AlarmCancelsAnotherAlarm) {}

TEST_P(QuicEventLoopFactoryTest, DestructorWithPendingAlarm) {}

TEST_P(QuicEventLoopFactoryTest, NegativeTimeout) {}

TEST_P(QuicEventLoopFactoryTest, ScheduleAlarmInPastFromInsideAlarm) {}

}  // namespace
}  // namespace quic::test