1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53

content / public / test / web_transport_simple_test_server.h [blame]

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

#ifndef CONTENT_PUBLIC_TEST_WEB_TRANSPORT_SIMPLE_TEST_SERVER_H_
#define CONTENT_PUBLIC_TEST_WEB_TRANSPORT_SIMPLE_TEST_SERVER_H_

#include <memory>

#include "net/base/ip_endpoint.h"

namespace base {
class CommandLine;
class Thread;
}  // namespace base

namespace net {
class QuicSimpleServer;
}  // namespace net

namespace quic {
namespace test {
class QuicTestBackend;
}  // namespace test
}  // namespace quic

namespace content {

// A WebTransport over HTTP/3 test server for testing.
class WebTransportSimpleTestServer final {
 public:
  WebTransportSimpleTestServer();
  ~WebTransportSimpleTestServer();

  // Adds some command line flags which are needed to enable WebTransport.
  void SetUpCommandLine(base::CommandLine* command_line);

  // Starts the server.
  void Start();

  const net::IPEndPoint& server_address() const { return server_address_; }

 private:
  net::IPEndPoint server_address_;

  std::unique_ptr<quic::test::QuicTestBackend> backend_;
  std::unique_ptr<net::QuicSimpleServer> server_;
  std::unique_ptr<base::Thread> server_thread_;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_TEST_WEB_TRANSPORT_SIMPLE_TEST_SERVER_H_