chromium/chrome/browser/extensions/api/socket/tls_socket_unittest.cc

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

#include <memory>
#include <utility>

#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_storage_partition.h"
#include "extensions/browser/api/socket/tls_socket.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/socket/socket_test_util.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/network_context.h"
#include "services/network/public/mojom/network_context.mojom.h"

namespace extensions {

namespace {

const char kTestMsg[] =;
const int kTestMsgLength =;

const char FAKE_ID[] =;

ConnectFuture;

ReadFuture;

UpgradeToTLSFuture;

WriteFuture;

class TLSSocketTestBase : public extensions::ExtensionServiceTestBase {};

}  // namespace

class TLSSocketTest : public TLSSocketTestBase,
                      public ::testing::WithParamInterface<net::IoMode> {};

TEST_F(TLSSocketTest, DestroyWhileReadPending) {}

// UpgradeToTLS() fails when there is a pending read.
TEST_F(TLSSocketTest, UpgradeToTLSWhilePendingRead) {}

TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS12) {}

// Test the API can parse "tls1.3".
TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS13) {}

// Test that the API maps minimum versions of TLS 1.0, a no longer supported
// protocol, to TLS 1.2.
TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS10) {}

// Test that the API maps minimum versions of TLS 1.1, a no longer supported
// protocol, to TLS 1.2.
TEST_F(TLSSocketTest, UpgradeToTLSWithCustomOptionsTLS11) {}

INSTANTIATE_TEST_SUITE_P();

TEST_P(TLSSocketTest, ReadWrite) {}

// Tests the case where read size is smaller than the actual message.
TEST_P(TLSSocketTest, PartialRead) {}

TEST_P(TLSSocketTest, ReadError) {}

// Tests the case where a message is split over two separate socket writes.
TEST_P(TLSSocketTest, MultipleWrite) {}

TEST_P(TLSSocketTest, PartialWrite) {}

TEST_P(TLSSocketTest, WriteError) {}

}  // namespace extensions