chromium/mojo/core/core_ipcz_test.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "mojo/core/core_ipcz.h"

#include <cstring>
#include <string_view>

#include "base/check.h"
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "build/blink_buildflags.h"
#include "build/build_config.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/core/ipcz_api.h"
#include "mojo/core/ipcz_driver/transport.h"
#include "mojo/core/test/mojo_test_base.h"
#include "mojo/public/c/system/invitation.h"
#include "mojo/public/c/system/thunks.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/platform/platform_handle.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo::core {
namespace {

struct InvitationDetails {};

// Basic smoke tests for the Mojo Core API as implemented over ipcz.
class CoreIpczTest : public test::MojoTestBase {};

// Watches a PlatformChannel endpoint handle for its peer's closure.
class ChannelPeerClosureListener {};

class CoreIpczTestClient : public CoreIpczTest {};

TEST_F(CoreIpczTest, Close) {}

TEST_F(CoreIpczTest, BasicMessageUsage) {}

TEST_F(CoreIpczTest, MessageDestruction) {}

TEST_F(CoreIpczTest, MessagePipes) {}

TEST_F(CoreIpczTest, Traps) {}

TEST_F(CoreIpczTest, WrapPlatformHandle) {}

TEST_F(CoreIpczTest, BasicSharedBuffer) {}

TEST_F(CoreIpczTest, SharedBufferDuplicateUnsafe) {}

TEST_F(CoreIpczTest, DataPipeReadWriteQeury) {}

TEST_F(CoreIpczTest, DataPipeTwoPhase) {}

#if BUILDFLAG(USE_BLINK)

constexpr std::string_view kAttachmentName =;

constexpr std::string_view kTestMessages[] =;

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(InvitationSingleAttachmentClient,
                                  CoreIpczTestClient,
                                  h) {}

TEST_F(CoreIpczTest, InvitationSingleAttachment) {}

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(InvitationMultipleAttachmentsClient,
                                  CoreIpczTestClient,
                                  h) {}

TEST_F(CoreIpczTest, InvitationMultipleAttachments) {}

constexpr std::string_view kDataPipeMessage =;
constexpr size_t kDataPipeCapacity =;
static_assert;

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(DataPipeTransferClient,
                                  CoreIpczTestClient,
                                  h) {}

TEST_F(CoreIpczTest, DataPipeTransfer) {}

#endif  // BUILDFLAG(USE_BLINK)

}  // namespace
}  // namespace mojo::core