#include "services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/test/test_io_thread.h"
#include "base/test/trace_event_analyzer.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_manager_test_utils.h"
#include "base/trace_event/memory_dump_scheduler.h"
#include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/trace_buffer.h"
#include "base/trace_event/trace_config.h"
#include "base/trace_event/trace_config_memory_test_util.h"
#include "base/trace_event/trace_log.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer_proto.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
AnyNumber;
Invoke;
Return;
MemoryAllocatorDump;
MemoryDumpArgs;
MemoryDumpDeterminism;
MemoryDumpLevelOfDetail;
MemoryDumpManager;
MemoryDumpProvider;
MemoryDumpRequestArgs;
MemoryDumpScheduler;
MemoryDumpType;
ProcessMemoryDump;
TraceConfig;
TraceLog;
TraceResultBuffer;
namespace memory_instrumentation {
namespace {
constexpr char kMDPName[] = …;
constexpr char kWhitelistedMDPName[] = …;
constexpr char kBackgroundButNotSummaryWhitelistedMDPName[] = …;
constexpr auto kTestMDPWhitelist = …;
MATCHER(IsDetailedDump, "") { … }
MATCHER(IsLightDump, "") { … }
MATCHER(IsBackgroundDump, "") { … }
class MockMemoryDumpProvider : public MemoryDumpProvider { … };
}
class MemoryTracingIntegrationTest;
class MockCoordinator : public mojom::Coordinator { … };
class MemoryTracingIntegrationTest : public testing::Test { … };
void MockCoordinator::RequestGlobalMemoryDump(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail,
MemoryDumpDeterminism determinism,
const std::vector<std::string>& allocator_dump_names,
RequestGlobalMemoryDumpCallback callback) { … }
void MockCoordinator::RequestGlobalMemoryDumpAndAppendToTrace(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail,
MemoryDumpDeterminism determinism,
RequestGlobalMemoryDumpAndAppendToTraceCallback callback) { … }
TEST_F(MemoryTracingIntegrationTest, InitializedAfterStartOfTracing) { … }
TEST_F(MemoryTracingIntegrationTest, TestBackgroundTracingSetup) { … }
TEST_F(MemoryTracingIntegrationTest, TraceConfigExpectations) { … }
TEST_F(MemoryTracingIntegrationTest, TraceConfigExpectationsWhenIsCoordinator) { … }
TEST_F(MemoryTracingIntegrationTest, PeriodicDumpingWithMultipleModes) { … }
TEST_F(MemoryTracingIntegrationTest, TestWhitelistingMDP) { … }
TEST_F(MemoryTracingIntegrationTest, GenerationChangeDoesntReenterMDM) { … }
}