1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/test/embedded_test_server/http_connection.h"
6
7 #include "net/socket/stream_socket.h"
8 #include "net/test/embedded_test_server/http1_connection.h"
9 #include "net/test/embedded_test_server/http2_connection.h"
10
11 namespace net::test_server {
12
Create(std::unique_ptr<StreamSocket> socket,EmbeddedTestServerConnectionListener * listener,EmbeddedTestServer * server,Protocol protocol)13 std::unique_ptr<HttpConnection> HttpConnection::Create(
14 std::unique_ptr<StreamSocket> socket,
15 EmbeddedTestServerConnectionListener* listener,
16 EmbeddedTestServer* server,
17 Protocol protocol) {
18 switch (protocol) {
19 case Protocol::kHttp1:
20 return std::make_unique<Http1Connection>(std::move(socket), listener,
21 server);
22 case Protocol::kHttp2:
23 return std::make_unique<Http2Connection>(std::move(socket), listener,
24 server);
25 }
26 }
27
28 } // namespace net::test_server
29