chromium/net/test/embedded_test_server/connection_tracker.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/test/embedded_test_server/connection_tracker.h"

#include "base/containers/contains.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

bool GetPort(const net::StreamSocket& connection, uint16_t* port) {}

}  // namespace

namespace net::test_server {

ConnectionTracker::ConnectionTracker(EmbeddedTestServer* test_server)
    :{}

ConnectionTracker::~ConnectionTracker() = default;

void ConnectionTracker::AcceptedSocketWithPort(uint16_t port) {}

void ConnectionTracker::ReadFromSocketWithPort(uint16_t port) {}

// Returns the number of sockets that were accepted by the server.
size_t ConnectionTracker::GetAcceptedSocketCount() const {}

// Returns the number of sockets that were read from by the server.
size_t ConnectionTracker::GetReadSocketCount() const {}

void ConnectionTracker::WaitUntilConnectionRead() {}

// This will wait for exactly |num_connections| items in |sockets_|. This method
// expects the server will not accept more than |num_connections| connections.
// |num_connections| must be greater than 0.
void ConnectionTracker::WaitForAcceptedConnections(size_t num_connections) {}

// Helper function to stop the waiting for sockets to be accepted for
// WaitForAcceptedConnections. |num_accepted_connections_loop_| spins
// until |num_accepted_connections_needed_| sockets are accepted by the test
// server. The values will be null/0 if the loop is not running.
void ConnectionTracker::CheckAccepted() {}

void ConnectionTracker::ResetCounts() {}

ConnectionTracker::ConnectionListener::ConnectionListener(
    ConnectionTracker* tracker)
    :{}

ConnectionTracker::ConnectionListener::~ConnectionListener() = default;

// Gets called from the EmbeddedTestServer thread to be notified that
// a connection was accepted.
std::unique_ptr<net::StreamSocket>
ConnectionTracker::ConnectionListener::AcceptedSocket(
    std::unique_ptr<net::StreamSocket> connection) {}

// Gets called from the EmbeddedTestServer thread to be notified that
// a connection was read from.
void ConnectionTracker::ConnectionListener::ReadFromSocket(
    const net::StreamSocket& connection,
    int rv) {}

}  // namespace net::test_server