chromium/base/trace_event/process_memory_dump_unittest.cc

// Copyright 2015 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/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) {}

}  // namespace

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)
// TODO(crbug.com/42050620): Counting resident bytes is not supported on
// Fuchsia.
#define MAYBE_CountResidentBytes
#else
#define MAYBE_CountResidentBytes
#endif
TEST(ProcessMemoryDumpTest, MAYBE_CountResidentBytes) {}

#if BUILDFLAG(IS_FUCHSIA)
// TODO(crbug.com/42050620): Counting resident bytes is not supported on
// Fuchsia.
#define MAYBE_CountResidentBytesInSharedMemory
#else
#define MAYBE_CountResidentBytesInSharedMemory
#endif
TEST(ProcessMemoryDumpTest, MAYBE_CountResidentBytesInSharedMemory) {}
#endif  // defined(COUNT_RESIDENT_BYTES_SUPPORTED)

}  // namespace base::trace_event