#include "chrome/browser/ui/webui/top_chrome/webui_contents_preload_manager.h"
#include <memory>
#include <optional>
#include <vector>
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/top_chrome/preload_candidate_selector.h"
#include "chrome/browser/ui/webui/top_chrome/preload_context.h"
#include "chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h"
#include "chrome/browser/ui/webui/top_chrome/webui_contents_preload_manager_test_api.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/memory_pressure/fake_memory_pressure_monitor.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
_;
Return;
RequestResult;
namespace {
template <typename T>
T ExpectHasValue(std::optional<T> optional) { … }
class MockPreloadCandidateSelector : public webui::PreloadCandidateSelector { … };
}
class WebUIContentsPreloadManagerTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(WebUIContentsPreloadManagerTest, PreloadedContentsIsNullWithoutWarmup) { … }
TEST_F(WebUIContentsPreloadManagerTest, PreloadedContentsIsNotNullAfterWarmup) { … }
TEST_F(WebUIContentsPreloadManagerTest, NoPreloadUnderHeavyMemoryPressure) { … }
TEST_F(WebUIContentsPreloadManagerTest, RequestReturnsNonNull) { … }
TEST_F(WebUIContentsPreloadManagerTest,
PreloadedContentsIsNotNullAfterRequest) { … }
TEST_F(WebUIContentsPreloadManagerTest,
PreloadedContentsChangesAfterSecondWarmupWithDifferentContext) { … }
TEST_F(WebUIContentsPreloadManagerTest,
WebContentsDiffersAfterWarmupThenRequestWithDifferentContext) { … }
TEST_F(WebUIContentsPreloadManagerTest,
WebContentsSameAfterWarmupThenRequestWithSameContext) { … }
TEST_F(WebUIContentsPreloadManagerTest,
PreloadedContentsBecomesNullAfterProfileDestruction) { … }
TEST_F(WebUIContentsPreloadManagerTest, RequestNavigation) { … }
TEST_F(WebUIContentsPreloadManagerTest, IsReadyToShow) { … }
TEST_F(WebUIContentsPreloadManagerTest, RequestThenWarmupShouldNotCrash) { … }
TEST_F(WebUIContentsPreloadManagerTest, CandidateSelector) { … }
TEST_F(WebUIContentsPreloadManagerTest, PreloadOnWebUIDestroy) { … }
TEST_F(WebUIContentsPreloadManagerTest, RequestURLHasPath) { … }
TEST_F(WebUIContentsPreloadManagerTest, DelayPreloadUntilNonEmptyPaint) { … }
TEST_F(WebUIContentsPreloadManagerTest, DelayPreloadUntilDeadline) { … }
TEST_F(WebUIContentsPreloadManagerTest, PendingDelayCancelDueToNewPreload) { … }
TEST_F(WebUIContentsPreloadManagerTest, PendingDelayCancelDueToProfileDestroy) { … }
TEST_F(WebUIContentsPreloadManagerTest, DelayPreloadFireOnce) { … }