#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stdint.h>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/completion_once_callback.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/test_completion_callback.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/socket/server_socket.h"
#include "net/socket/socket_test_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/mojo_socket_test_util.h"
#include "services/network/proxy_resolving_socket_factory_mojo.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/public/mojom/tls_socket.mojom.h"
#include "services/network/socket_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
const char kMsg[] = …;
const size_t kMsgSize = …;
const char kSecretMsg[] = …;
const size_t kSecretMsgSize = …;
class TLSClientSocketTestBase { … };
class TLSClientSocketTest
: public ::testing::TestWithParam<TLSClientSocketTestBase::Mode>,
public TLSClientSocketTestBase { … };
TEST_P(TLSClientSocketTest, UpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, ClosePipesRunUntilIdleAndUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, UpgradeToTLSTwice) { … }
TEST_P(TLSClientSocketTest, UpgradeToTLSWithCustomSSLConfig) { … }
TEST_P(TLSClientSocketTest, ReadWriteBeforeUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, ReadErrorAfterUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, WriteErrorAfterUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, ReadFromPreTlsDataPipeAfterUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, WriteToPreTlsDataPipeAfterUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, ReadAndWritePreTlsDataPipeAfterUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, ReadErrorBeforeUpgradeToTLS) { … }
TEST_P(TLSClientSocketTest, WriteErrorBeforeUpgradeToTLS) { … }
INSTANTIATE_TEST_SUITE_P(…);
class TLSCLientSocketProxyTest : public ::testing::Test,
public TLSClientSocketTestBase { … };
TEST_F(TLSCLientSocketProxyTest, UpgradeToTLS) { … }
class TLSClientSocketIoModeTest : public TLSClientSocketTestBase,
public testing::TestWithParam<net::IoMode> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(TLSClientSocketIoModeTest, MultipleWriteToTLSSocket) { … }
TEST_P(TLSClientSocketIoModeTest, SSLInfo) { … }
class TLSClientSocketTestWithEmbeddedTestServerBase
: public TLSClientSocketTestBase { … };
class TLSClientSocketTestWithEmbeddedTestServer
: public TLSClientSocketTestWithEmbeddedTestServerBase,
public ::testing::TestWithParam<TLSClientSocketTestBase::Mode> { … };
TEST_P(TLSClientSocketTestWithEmbeddedTestServer, Basic) { … }
TEST_P(TLSClientSocketTestWithEmbeddedTestServer, ServerCertError) { … }
INSTANTIATE_TEST_SUITE_P(…);
class TLSClientSocketDirectTestWithEmbeddedTestServer
: public TLSClientSocketTestWithEmbeddedTestServerBase,
public testing::Test { … };
TEST_F(TLSClientSocketDirectTestWithEmbeddedTestServer, SSLInfo) { … }
TEST_F(TLSClientSocketDirectTestWithEmbeddedTestServer,
SSLInfoServerCertError) { … }
TEST_F(TLSClientSocketDirectTestWithEmbeddedTestServer,
UnsafelySkipCertVerification) { … }
TEST_F(TLSClientSocketDirectTestWithEmbeddedTestServer,
UnsafelySkipCertVerificationServerCertError) { … }
}
}