chromium/services/network/web_transport_unittest.cc

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

#include "services/network/web_transport.h"

#include <set>
#include <vector>

#include "base/containers/contains.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/log/test_net_log.h"
#include "net/quic/quic_context.h"
#include "net/test/test_data_directory.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/proof_source_x509.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_backend.h"
#include "net/tools/quic/quic_simple_server.h"
#include "net/url_request/url_request_context.h"
#include "services/network/network_context.h"
#include "services/network/network_service.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/test/fake_test_cert_verifier_params_factory.h"
#include "services/network/url_request_context_builder_mojo.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/boringssl/src/pki/pem.h"

namespace network {
namespace {

class HostResolverFactory final : public net::HostResolver::Factory {};

// A clock that only mocks out WallNow(), but uses real Now() and
// ApproximateNow().  Useful for certificate verification.
class TestWallClock : public quic::QuicClock {};

class TestConnectionHelper : public quic::QuicConnectionHelperInterface {};

mojom::NetworkContextParamsPtr CreateNetworkContextParams() {}

// We don't use mojo::BlockingCopyToString because it leads to deadlocks.
std::string Read(mojo::ScopedDataPipeConsumerHandle readable) {}

class TestHandshakeClient final : public mojom::WebTransportHandshakeClient {};

class TestClient final : public mojom::WebTransportClient {};

quic::ParsedQuicVersion GetTestVersion() {}

class WebTransportTest : public testing::TestWithParam<std::string_view> {};

TEST_F(WebTransportTest, ConnectSuccessfully) {}

TEST_F(WebTransportTest, ConnectHandles404) {}

TEST_F(WebTransportTest, ConnectToBannedPort) {}

TEST_F(WebTransportTest, SendDatagram) {}

TEST_F(WebTransportTest, SendToolargeDatagram) {}

TEST_F(WebTransportTest, EchoOnUnidirectionalStreams) {}

TEST_F(WebTransportTest, DeleteClientWithStreamsOpen) {}

// crbug.com/1129847: disabled because it is flaky.
TEST_F(WebTransportTest, DISABLED_EchoOnBidirectionalStream) {}

TEST_F(WebTransportTest, Stats) {}

class WebTransportWithCustomCertificateTest : public WebTransportTest {};

TEST_F(WebTransportWithCustomCertificateTest, WithValidFingerprint) {}

TEST_F(WebTransportWithCustomCertificateTest, WithInvalidFingerprint) {}

}  // namespace
}  // namespace network