#include "base/trace_event/process_memory_dump.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <string_view>
#include "base/memory/aligned_memory.h"
#include "base/memory/ptr_util.h"
#include "base/memory/shared_memory_tracker.h"
#include "base/memory/writable_shared_memory_region.h"
#include "base/process/process_metrics.h"
#include "base/trace_event/memory_allocator_dump_guid.h"
#include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/trace_log.h"
#include "base/trace_event/traced_value.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "winbase.h"
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#include <sys/mman.h>
#endif
namespace base::trace_event {
namespace {
const MemoryDumpArgs kDetailedDumpArgs = …;
constexpr std::string_view kTestDumpNameAllowlist[] = …;
void* Map(size_t size) { … }
void Unmap(void* addr, size_t size) { … }
std::optional<size_t> CountResidentBytesInSharedMemory(
const WritableSharedMemoryMapping& mapping) { … }
}
TEST(ProcessMemoryDumpTest, MoveConstructor) { … }
TEST(ProcessMemoryDumpTest, MoveAssignment) { … }
TEST(ProcessMemoryDumpTest, Clear) { … }
TEST(ProcessMemoryDumpTest, TakeAllDumpsFrom) { … }
TEST(ProcessMemoryDumpTest, OverrideOwnershipEdge) { … }
TEST(ProcessMemoryDumpTest, Suballocations) { … }
TEST(ProcessMemoryDumpTest, GlobalAllocatorDumpTest) { … }
TEST(ProcessMemoryDumpTest, SharedMemoryOwnershipTest) { … }
TEST(ProcessMemoryDumpTest, BackgroundModeTest) { … }
TEST(ProcessMemoryDumpTest, GuidsTest) { … }
#if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_CountResidentBytes …
#else
#define MAYBE_CountResidentBytes …
#endif
TEST(ProcessMemoryDumpTest, MAYBE_CountResidentBytes) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_CountResidentBytesInSharedMemory …
#else
#define MAYBE_CountResidentBytesInSharedMemory …
#endif
TEST(ProcessMemoryDumpTest, MAYBE_CountResidentBytesInSharedMemory) { … }
#endif
}