#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/socket/ssl_server_socket.h"
#include <stdint.h>
#include <stdlib.h>
#include <memory>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/containers/queue.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "crypto/rsa_private_key.h"
#include "net/base/address_list.h"
#include "net/base/completion_once_callback.h"
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/cert/mock_client_cert_verifier.h"
#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/cert/x509_certificate.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/ssl_client_socket.h"
#include "net/socket/stream_socket.h"
#include "net/ssl/openssl_private_key.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_cipher_suite_names.h"
#include "net/ssl/ssl_client_session_cache.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/ssl/ssl_info.h"
#include "net/ssl/ssl_private_key.h"
#include "net/ssl/ssl_server_config.h"
#include "net/ssl/test_ssl_config_service.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
IsError;
IsOk;
namespace net {
namespace {
#if BUILDFLAG(ENABLE_CLIENT_CERTIFICATES)
const char kClientCertFileName[] = …;
const char kClientPrivateKeyFileName[] = …;
const char kWrongClientCertFileName[] = …;
const char kWrongClientPrivateKeyFileName[] = …;
#endif
const uint16_t kEcdheCiphers[] = …;
class FakeDataChannel { … };
class FakeSocket : public StreamSocket { … };
}
TEST(FakeSocketTest, DataTransfer) { … }
class SSLServerSocketTest : public PlatformTest, public WithTaskEnvironment { … };
class SSLServerSocketReadTest : public SSLServerSocketTest,
public ::testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(SSLServerSocketTest, Initialize) { … }
TEST_F(SSLServerSocketTest, Handshake) { … }
TEST_F(SSLServerSocketTest, HandshakeCached) { … }
TEST_F(SSLServerSocketTest, HandshakeCachedContextSwitch) { … }
#if BUILDFLAG(ENABLE_CLIENT_CERTIFICATES)
TEST_F(SSLServerSocketTest, HandshakeWithClientCert) { … }
TEST_F(SSLServerSocketTest, HandshakeWithClientCertCached) { … }
TEST_F(SSLServerSocketTest, HandshakeWithClientCertRequiredNotSupplied) { … }
TEST_F(SSLServerSocketTest, HandshakeWithClientCertRequiredNotSuppliedCached) { … }
TEST_F(SSLServerSocketTest, HandshakeWithWrongClientCertSupplied) { … }
TEST_F(SSLServerSocketTest, HandshakeWithWrongClientCertSuppliedTLS12) { … }
TEST_F(SSLServerSocketTest, HandshakeWithWrongClientCertSuppliedCached) { … }
#endif
TEST_P(SSLServerSocketReadTest, DataTransfer) { … }
TEST_F(SSLServerSocketTest, ClientWriteAfterServerClose) { … }
TEST_F(SSLServerSocketTest, ExportKeyingMaterial) { … }
TEST_F(SSLServerSocketTest, RequireEcdheFlag) { … }
TEST_F(SSLServerSocketTest, HandshakeServerSSLPrivateKey) { … }
namespace {
class SSLPrivateKeyHook : public SSLPrivateKey { … };
}
TEST_F(SSLServerSocketTest,
HandshakeServerSSLPrivateKeyDisconnectDuringSigning_ReturnsError) { … }
TEST_F(SSLServerSocketTest, HandshakeServerSSLPrivateKeyRequireEcdhe) { … }
class SSLServerSocketAlpsTest
: public SSLServerSocketTest,
public ::testing::WithParamInterface<std::tuple<bool, bool>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(SSLServerSocketAlpsTest, Alps) { … }
TEST_F(SSLServerSocketTest, CancelReadIfReady) { … }
}