#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/metrics/persistent_memory_allocator.h"
#include <memory>
#include "base/containers/heap_array.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_span.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/memory/writable_shared_memory_region.h"
#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/strings/safe_sprintf.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/test/gtest_util.h"
#include "base/threading/simple_thread.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace base {
namespace {
const uint32_t TEST_MEMORY_SIZE = …;
const uint32_t TEST_MEMORY_PAGE = …;
const uint32_t TEST_ID = …;
const char TEST_NAME[] = …;
void SetFileLength(const base::FilePath& path, size_t length) { … }
}
Reference;
class PersistentMemoryAllocatorTest : public testing::Test { … };
TEST_F(PersistentMemoryAllocatorTest, AllocateAndIterate) { … }
TEST_F(PersistentMemoryAllocatorTest, PageTest) { … }
class AllocatorThread : public SimpleThread { … };
TEST_F(PersistentMemoryAllocatorTest, ParallelismTest) { … }
class MakeIterableThread : public SimpleThread { … };
TEST_F(PersistentMemoryAllocatorTest, MakeIterableSameRefsTest) { … }
class CounterThread : public SimpleThread { … };
TEST_F(PersistentMemoryAllocatorTest, IteratorParallelismTest) { … }
TEST_F(PersistentMemoryAllocatorTest, DelayedAllocationTest) { … }
#if defined(THREAD_SANITIZER)
#define MAYBE_CorruptionTest …
#else
#define MAYBE_CorruptionTest …
#endif
TEST_F(PersistentMemoryAllocatorTest, MAYBE_CorruptionTest) { … }
TEST_F(PersistentMemoryAllocatorTest, MaliciousTest) { … }
TEST(LocalPersistentMemoryAllocatorTest, CreationTest) { … }
TEST(SharedPersistentMemoryAllocatorTest, CreationTest) { … }
#if !BUILDFLAG(IS_NACL)
TEST(FilePersistentMemoryAllocatorTest, CreationTest) { … }
TEST(FilePersistentMemoryAllocatorTest, ExtendTest) { … }
TEST(FilePersistentMemoryAllocatorTest, AcceptableTest) { … }
TEST_F(PersistentMemoryAllocatorTest, TruncateTest) { … }
#endif
}