#include "components/performance_manager/public/v8_memory/v8_detailed_memory.h"
#include "components/performance_manager/public/v8_memory/v8_detailed_memory_any_seq.h"
#include <memory>
#include <tuple>
#include <utility>
#include "base/barrier_closure.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/gtest_util.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/performance_manager/graph/frame_node_impl.h"
#include "components/performance_manager/graph/page_node_impl.h"
#include "components/performance_manager/graph/process_node_impl.h"
#include "components/performance_manager/graph/worker_node_impl.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/render_process_host_id.h"
#include "components/performance_manager/public/render_process_host_proxy.h"
#include "components/performance_manager/test_support/graph_test_harness.h"
#include "components/performance_manager/v8_memory/v8_memory_test_helpers.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/tokens/tokens.h"
namespace performance_manager {
namespace v8_memory {
_;
InSequence;
Mock;
StrictMock;
constexpr uint64_t kDetachedBytes = …;
constexpr uint64_t kSharedBytes = …;
constexpr uint64_t kBlinkBytes = …;
namespace {
class LenientMockV8DetailedMemoryObserver : public V8DetailedMemoryObserver { … };
MockV8DetailedMemoryObserver;
class LenientMockV8DetailedMemoryObserverAnySeq
: public V8DetailedMemoryObserverAnySeq { … };
MockV8DetailedMemoryObserverAnySeq;
MeasurementMode;
class LifetimeTestObject final { … };
constexpr base::TimeDelta kMinTimeBetweenRequests = …;
}
class V8DetailedMemoryDecoratorTest : public GraphTestHarness,
public V8MemoryTestBase { … };
class V8DetailedMemoryDecoratorModeTest
: public V8DetailedMemoryDecoratorTest,
public ::testing::WithParamInterface<
std::pair<MeasurementMode, ExpectedMode>> { … };
class V8DetailedMemoryDecoratorSingleProcessModeTest
: public V8DetailedMemoryDecoratorTest,
public ::testing::WithParamInterface<MeasurementMode> { … };
V8DetailedMemoryDecoratorDeathTest;
V8DetailedMemoryRequestAnySeqTest;
TEST_F(V8DetailedMemoryDecoratorTest, InstantiateOnEmptyGraph) { … }
TEST_F(V8DetailedMemoryDecoratorTest, InstantiateOnNonEmptyGraph) { … }
TEST_F(V8DetailedMemoryDecoratorTest, OnlyMeasureRenderers) { … }
TEST_F(V8DetailedMemoryDecoratorTest, OneShot) { … }
TEST_F(V8DetailedMemoryDecoratorTest, OneShotLifetime) { … }
TEST_F(V8DetailedMemoryDecoratorTest, OneShotLifetimeAtExit) { … }
TEST_F(V8DetailedMemoryDecoratorTest, QueryRateIsLimited) { … }
TEST_F(V8DetailedMemoryDecoratorTest, MultipleProcessesHaveDistinctSchedules) { … }
TEST_F(V8DetailedMemoryDecoratorTest, MultipleIsolatesInRenderer) { … }
TEST_F(V8DetailedMemoryDecoratorTest, DataIsDistributed) { … }
TEST_P(V8DetailedMemoryDecoratorModeTest, LazyRequests) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(V8DetailedMemoryDecoratorTest, MeasurementRequestsSorted) { … }
TEST_F(V8DetailedMemoryDecoratorTest, MeasurementRequestsWithDelay) { … }
TEST_F(V8DetailedMemoryDecoratorTest, MeasurementRequestOutlivesDecorator) { … }
TEST_F(V8DetailedMemoryDecoratorTest, NotifyObservers) { … }
TEST_F(V8DetailedMemoryDecoratorTest, ObserverOutlivesDecorator) { … }
TEST_F(V8DetailedMemoryDecoratorTest, SingleProcessRequest) { … }
TEST_P(V8DetailedMemoryDecoratorSingleProcessModeTest,
SingleProcessLazyRequest) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(V8DetailedMemoryDecoratorDeathTest, MultipleStartMeasurement) { … }
TEST_F(V8DetailedMemoryDecoratorDeathTest, EnforceObserversRemoved) { … }
TEST_F(V8DetailedMemoryDecoratorDeathTest, InvalidEagerModeConfig) { … }
TEST_F(V8DetailedMemoryDecoratorDeathTest, NonPositiveTimeDeltas) { … }
TEST_F(V8DetailedMemoryDecoratorDeathTest, ExtremeTImeDeltas) { … }
TEST_F(V8DetailedMemoryRequestAnySeqTest, RequestIsSequenceSafe) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_SingleProcessRequest …
#else
#define MAYBE_SingleProcessRequest …
#endif
TEST_F(V8DetailedMemoryRequestAnySeqTest, MAYBE_SingleProcessRequest) { … }
TEST_F(V8DetailedMemoryRequestAnySeqTest, OneShot) { … }
TEST_F(V8DetailedMemoryRequestAnySeqTest, OneShotLifetime) { … }
TEST_F(V8DetailedMemoryRequestAnySeqTest, OneShotLifetimeAtExit) { … }
TEST_F(V8DetailedMemoryDecoratorTest, DedicatedWorkers) { … }
TEST_F(V8DetailedMemoryDecoratorTest, CanvasMemory) { … }
}
}