chromium/mojo/core/platform_wrapper_unittest.cc

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

#include <stdint.h>
#include <string.h>

#include <algorithm>
#include <string>
#include <vector>

#include "base/containers/span.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/process/process_handle.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "mojo/core/test/mojo_test_base.h"
#include "mojo/public/c/system/platform_handle.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_WIN)
#include <windows.h>

#include "base/win/scoped_handle.h"
#elif BUILDFLAG(IS_APPLE)
#include "base/apple/scoped_mach_port.h"
#endif

#if BUILDFLAG(IS_WIN)
#define SIMPLE_PLATFORM_HANDLE_TYPE
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#define SIMPLE_PLATFORM_HANDLE_TYPE
#endif

#if BUILDFLAG(IS_FUCHSIA)
#define SHARED_BUFFER_PLATFORM_HANDLE_TYPE
#elif BUILDFLAG(IS_APPLE)
#define SHARED_BUFFER_PLATFORM_HANDLE_TYPE
#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX)
#define SHARED_BUFFER_PLATFORM_HANDLE_TYPE
#endif

uint64_t PlatformHandleValueFromPlatformFile(base::PlatformFile file) {}

base::PlatformFile PlatformFileFromPlatformHandleValue(uint64_t value) {}

namespace mojo {
namespace core {
namespace {

PlatformWrapperTest;

#if BUILDFLAG(IS_IOS)
// TODO(crbug.com/40257752): Test currently fails on iOS.
#define MAYBE_WrapPlatformHandle
#else
#define MAYBE_WrapPlatformHandle
#endif  // BUILDFLAG(IS_IOS)
TEST_F(PlatformWrapperTest, MAYBE_WrapPlatformHandle) {}

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(ReadPlatformFile, PlatformWrapperTest, h) {}

#if BUILDFLAG(IS_IOS)
// TODO(crbug.com/40257752): Test currently fails on iOS.
#define MAYBE_WrapPlatformSharedMemoryRegion
#else
#define MAYBE_WrapPlatformSharedMemoryRegion
#endif  // BUILDFLAG(IS_IOS)
TEST_F(PlatformWrapperTest, MAYBE_WrapPlatformSharedMemoryRegion) {}

DEFINE_TEST_CLIENT_TEST_WITH_PIPE(ReadPlatformSharedBuffer,
                                  PlatformWrapperTest,
                                  h) {}

TEST_F(PlatformWrapperTest, InvalidHandle) {}

TEST_F(PlatformWrapperTest, InvalidArgument) {}

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