chromium/base/memory/shared_memory_mapping_unittest.cc

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

#include "base/memory/shared_memory_mapping.h"

#include <stdint.h>

#include <atomic>
#include <limits>

#include "base/containers/span.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/writable_shared_memory_region.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {

class SharedMemoryMappingTest : public ::testing::Test {};

TEST_F(SharedMemoryMappingTest, Invalid) {}

TEST_F(SharedMemoryMappingTest, Scalar) {}

TEST_F(SharedMemoryMappingTest, SpanWithAutoDeducedElementCount) {}

TEST_F(SharedMemoryMappingTest, SpanWithExplicitElementCount) {}

TEST_F(SharedMemoryMappingTest, SpanWithZeroElementCount) {}

TEST_F(SharedMemoryMappingTest, TooBigScalar) {}

TEST_F(SharedMemoryMappingTest, TooBigSpanWithAutoDeducedElementCount) {}

TEST_F(SharedMemoryMappingTest, TooBigSpanWithExplicitElementCount) {}

TEST_F(SharedMemoryMappingTest, Atomic) {}

TEST_F(SharedMemoryMappingTest, TooBigAtomic) {}

// TODO(dcheng): This test is temporarily disabled on iOS. iOS devices allow
// the creation of a 1GB shared memory region, but don't allow the region to be
// mapped.
#if !BUILDFLAG(IS_IOS)
// TODO(crbug.com/40846204) Fix flakiness and re-enable on Linux and ChromeOS.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_TotalMappedSizeLimit
#else
#define MAYBE_TotalMappedSizeLimit
#endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
TEST_F(SharedMemoryMappingTest, MAYBE_TotalMappedSizeLimit) {}
#endif  // !BUILDFLAG(IS_IOS)

}  // namespace base