chromium/chrome/browser/performance_manager/policies/page_discarding_helper_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/performance_manager/policies/page_discarding_helper.h"

#include <memory>
#include <string>
#include <utility>

#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/performance_manager/policies/policy_features.h"
#include "chrome/browser/performance_manager/test_support/page_discarding_utils.h"
#include "components/performance_manager/public/decorators/page_live_state_decorator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace performance_manager {
namespace policies {

CanDiscardResult;
DiscardReason;
Return;

class PageDiscardingHelperTest
    : public testing::GraphTestHarnessWithMockDiscarder {};

TEST_F(PageDiscardingHelperTest, TestCanDiscardMultipleCurrentMainFrames) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardVisiblePage) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardAudiblePage) {}

TEST_F(PageDiscardingHelperTest,
       TestCannotDiscardPageWithDiscardAttemptMarker) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardRecentlyAudiblePage) {}

TEST_F(PageDiscardingHelperTest, TestCanDiscardNeverAudiblePage) {}

#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(PageDiscardingHelperTest,
       TestCannotDiscardRecentlyVisiblePageUnlessExplicitlyRequested) {}
#endif

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPdf) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageWithoutMainFrame) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardExtension) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageWithInvalidURL) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageProtectedByExtension) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageCapturingVideo) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageCapturingAudio) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageBeingMirrored) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageCapturingWindow) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageCapturingDisplay) {}

TEST_F(PageDiscardingHelperTest,
       TestCannotDiscardPageConnectedToBluetoothDevice) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardIsConnectedToUSBDevice) {}

#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageMultipleTimes) {}
#endif

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageWithFormInteractions) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageWithUserEdits) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardActiveTab) {}

TEST_F(PageDiscardingHelperTest,
       TestCannotProactivelyDiscardWithNotificationPermission) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPageOnNoDiscardList) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardPinnedTab) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardWithDevToolsOpen) {}

TEST_F(PageDiscardingHelperTest,
       TestCannotProactivelyDiscardAfterUpdatedTitleOrFaviconInBackground) {}

TEST_F(PageDiscardingHelperTest, TestCannotDiscardWithPictureInPicture) {}

// Tests DiscardMultiplePages.

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesNoCandidate) {}

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesDiscardProtected) {}

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesTwoCandidates) {}

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesTwoCandidatesProtected) {}

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesThreeCandidates) {}

TEST_F(PageDiscardingHelperTest,
       DiscardMultiplePagesThreeCandidatesWithPriority) {}

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesNoDiscardable) {}

// Tests DiscardAPage.

TEST_F(PageDiscardingHelperTest, DiscardAPageNoCandidate) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageSingleCandidate) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageSingleCandidateFails) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageTwoCandidates) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageTwoCandidatesFirstFails) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageTwoCandidatesMultipleFrames) {}

TEST_F(PageDiscardingHelperTest, DiscardAPageTwoCandidatesNoRSSData) {}

// Tests DiscardMultiplePages with reclaim_target_kb == nullopt.

TEST_F(PageDiscardingHelperTest, DiscardMultiplePagesTwoCandidatesNoRSSData) {}

TEST_F(PageDiscardingHelperTest, DiscardingProtectedTabReported) {}

TEST_F(PageDiscardingHelperTest, DiscardingUnprotectedTabReported) {}

TEST_F(PageDiscardingHelperTest, DiscardingFocusedTabReported) {}

TEST_F(PageDiscardingHelperTest, DiscardingUnfocusedTabReported) {}

}  // namespace policies
}  // namespace performance_manager