#include "components/performance_manager/freezing/freezing_policy.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "components/performance_manager/freezing/freezer.h"
#include "components/performance_manager/graph/graph_impl.h"
#include "components/performance_manager/graph/process_node_impl.h"
#include "components/performance_manager/public/decorators/page_live_state_decorator.h"
#include "components/performance_manager/public/features.h"
#include "components/performance_manager/public/freezing/freezing.h"
#include "components/performance_manager/public/graph/page_node.h"
#include "components/performance_manager/public/resource_attribution/origin_in_browsing_instance_context.h"
#include "components/performance_manager/public/resource_attribution/queries.h"
#include "components/performance_manager/public/resource_attribution/query_results.h"
#include "components/performance_manager/public/resource_attribution/resource_contexts.h"
#include "components/performance_manager/test_support/graph_test_harness.h"
#include "content/public/browser/browsing_instance_id.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
namespace performance_manager {
namespace {
Mock;
class LenientMockFreezer : public Freezer { … };
MockFreezer;
}
class FreezingPolicyTest : public GraphTestHarness { … };
TEST_F(FreezingPolicyTest, Basic) { … }
TEST_F(FreezingPolicyTest, ManyPagesSameBrowsingInstance) { … }
TEST_F(FreezingPolicyTest, ConnectedPages) { … }
TEST_F(FreezingPolicyTest,
AddCannotFreezeReasonToBrowsingInstanceWithManyPages) { … }
TEST_F(FreezingPolicyTest, AddCannotFreezeReasonToConnectedPages) { … }
TEST_F(FreezingPolicyTest,
AddFreezeVotesToBrowsingInstanceWithManyPagesAndCannotFreezeReason) { … }
TEST_F(FreezingPolicyTest,
AddFreezeVotesToConnectedPagesWithCannotFreezeReason) { … }
TEST_F(FreezingPolicyTest, BreakConnectedSet) { … }
TEST_F(FreezingPolicyTest, BreakConnectedSet_LeftSetIsFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenVisible) { … }
TEST_F(FreezingPolicyTest, BecomesVisibleWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenAudible) { … }
TEST_F(FreezingPolicyTest, BecomesAudibleWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenRecentlyAudible) { … }
TEST_F(FreezingPolicyTest, BecomesRecentlyAudibleWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenHoldingWebLock) { … }
TEST_F(FreezingPolicyTest, AcquiresWebLockWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenHoldingIndexedDBLock) { … }
TEST_F(FreezingPolicyTest, AcquiresIndexedDBLockWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenConnectedToUSBDevice) { … }
TEST_F(FreezingPolicyTest, ConnectedToUSBDeviceWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenConnectedToBluetoothDevice) { … }
TEST_F(FreezingPolicyTest, ConnectedToBluetoothDeviceWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenCapturingVideo) { … }
TEST_F(FreezingPolicyTest, StartsCapturingVideoWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenCapturingAudio) { … }
TEST_F(FreezingPolicyTest, StartsCapturingAudioWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenMirrored) { … }
TEST_F(FreezingPolicyTest, StartsBeingMirroredWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenCapturingWindow) { … }
TEST_F(FreezingPolicyTest, StartsCapturingWindowWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenCapturingDisplay) { … }
TEST_F(FreezingPolicyTest, StartsCapturingDisplayWhenFrozen) { … }
TEST_F(FreezingPolicyTest, FreezeVoteWhenLoading) { … }
TEST_F(FreezingPolicyTest, StartsLoadingWhenFrozen) { … }
namespace {
class FreezingPolicyBatterySaverTest : public FreezingPolicyTest { … };
}
TEST_F(FreezingPolicyBatterySaverTest, Basic) { … }
TEST_F(FreezingPolicyBatterySaverTest, ConnectedPages) { … }
TEST_F(FreezingPolicyBatterySaverTest, CannotFreeze) { … }
TEST_F(FreezingPolicyBatterySaverTest, CannotFreezeTransient) { … }
TEST_F(FreezingPolicyBatterySaverTest, BatterySaverInactive) { … }
TEST_F(FreezingPolicyBatterySaverTest, ForegroundCPU) { … }
TEST_F(FreezingPolicyBatterySaverTest, DeactivateBatterySaver) { … }
TEST_F(FreezingPolicyBatterySaverTest, ActivateBatterySaverAfterHighCPU) { … }
}