#include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/test/trace_test_utils.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "build/build_config.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 "services/tracing/public/cpp/perfetto/producer_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
RunOnceClosure;
_;
AllOf;
Contains;
Eq;
Field;
Invoke;
IsEmpty;
Ne;
NiceMock;
NotNull;
Pointee;
Property;
Return;
UnorderedElementsAre;
GetVmRegionsForHeapProfilerCallback;
RequestGlobalMemoryDumpAndAppendToTraceCallback;
RequestGlobalMemoryDumpCallback;
RequestGlobalMemoryDumpForPidCallback;
MemoryAllocatorDump;
MemoryDumpArgs;
MemoryDumpLevelOfDetail;
MemoryDumpManager;
MemoryDumpRequestArgs;
MemoryDumpType;
ProcessMemoryDump;
TraceLog;
GlobalMemoryDump;
GlobalMemoryDumpPtr;
namespace memory_instrumentation {
class FakeCoordinatorImpl : public CoordinatorImpl { … };
class CoordinatorImplTest : public testing::Test { … };
class MockClientProcess : public mojom::ClientProcess { … };
class MockGlobalMemoryDumpCallback { … };
class MockGlobalMemoryDumpAndAppendToTraceCallback { … };
class MockGetVmRegionsForHeapProfilerCallback { … };
uint64_t GetFakeAddrForVmRegion(int pid, int region_index) { … }
uint64_t GetFakeSizeForVmRegion(int pid, int region_index) { … }
mojom::RawOSMemDumpPtr FillRawOSDump(int pid) { … }
TEST_F(CoordinatorImplTest, NoClients) { … }
TEST_F(CoordinatorImplTest, SeveralClients) { … }
TEST_F(CoordinatorImplTest, QueuedRequest) { … }
TEST_F(CoordinatorImplTest, MissingChromeDump) { … }
TEST_F(CoordinatorImplTest, MissingOsDump) { … }
TEST_F(CoordinatorImplTest, TimeOutStuckChild) { … }
TEST_F(CoordinatorImplTest, TimeOutStuckChildMultiProcess) { … }
TEST_F(CoordinatorImplTest, ClientCrashDuringGlobalDump) { … }
TEST_F(CoordinatorImplTest, SingleClientCrashDuringGlobalDump) { … }
TEST_F(CoordinatorImplTest, GlobalMemoryDumpStruct) { … }
TEST_F(CoordinatorImplTest, VmRegionsForHeapProfiler) { … }
TEST_F(CoordinatorImplTest, DumpsArentAddedToTraceUnlessRequested) { … }
TEST_F(CoordinatorImplTest, DISABLED_DumpsAreAddedToTraceWhenRequested) { … }
TEST_F(CoordinatorImplTest, DumpByPidSuccess) { … }
TEST_F(CoordinatorImplTest, DumpByPidFailure) { … }
TEST_F(CoordinatorImplTest, GlobalDumpWithSubTrees) { … }
}