#include "chrome/browser/performance_manager/policies/memory_saver_mode_policy.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "chrome/browser/performance_manager/test_support/page_discarding_utils.h"
#include "components/performance_manager/public/decorators/tab_page_decorator.h"
#include "components/performance_manager/public/features.h"
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/performance_manager/public/user_tuning/tab_revisit_tracker.h"
#include "components/prefs/testing_pref_service.h"
namespace performance_manager::policies {
namespace {
constexpr base::TimeDelta AGGRESSIVE_TIMEOUT = …;
constexpr base::TimeDelta MEDIUM_TIMEOUT = …;
constexpr base::TimeDelta CONSERVATIVE_TIMEOUT = …;
}
class TestTabRevisitTracker : public TabRevisitTracker { … };
class MemorySaverModeTest : public testing::GraphTestHarnessWithMockDiscarder { … };
TEST_F(MemorySaverModeTest, NoDiscardIfMemorySaverOff) { … }
TEST_F(MemorySaverModeTest, DiscardAfterBackgrounded) { … }
TEST_F(MemorySaverModeTest, DiscardAfterAggressiveTimeout) { … }
TEST_F(MemorySaverModeTest, DiscardAfterConservativeTimeout) { … }
TEST_F(MemorySaverModeTest, DontDiscardAfterBackgroundedIfSuspended) { … }
TEST_F(MemorySaverModeTest, DontDiscardIfPageIsNotATab) { … }
TEST_F(MemorySaverModeTest, DontDiscardIfPlayingAudio) { … }
TEST_F(MemorySaverModeTest, DontDiscardIfAlreadyNotVisibleWhenModeEnabled) { … }
TEST_F(MemorySaverModeTest, NoDiscardIfPageNodeRemoved) { … }
TEST_F(MemorySaverModeTest, UnknownPageNodeNeverAddedToMap) { … }
TEST_F(MemorySaverModeTest, PageNodeDiscardedIfTypeChanges) { … }
TEST_F(MemorySaverModeTest,
DiscardAfterTimeForCurrentModeIfNumRevisitsUnderMax) { … }
TEST_F(MemorySaverModeTest, DontDiscardIfAboveMaxNumRevisits) { … }
}