#include "chrome/browser/predictors/loading_predictor_tab_helper.h"
#include "base/memory/raw_ptr.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/optimization_guide/mock_optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_test_util.h"
#include "chrome/browser/predictors/predictors_enums.h"
#include "chrome/browser/predictors/predictors_features.h"
#include "chrome/browser/sessions/session_tab_helper_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/variations/scoped_variations_ids_provider.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/test/navigation_simulator.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
_;
An;
ByRef;
DoAll;
Eq;
Invoke;
Mock;
NiceMock;
Return;
SaveArg;
StrictMock;
WithArg;
namespace predictors {
class MockLoadingDataCollector : public LoadingDataCollector { … };
MockLoadingDataCollector::MockLoadingDataCollector(
const LoadingPredictorConfig& config)
: … { … }
class LoadingPredictorTabHelperTest : public ChromeRenderViewHostTestHarness { … };
void LoadingPredictorTabHelperTest::SetUp() { … }
void LoadingPredictorTabHelperTest::TearDown() { … }
void LoadingPredictorTabHelperTest::
NavigateAndCommitInMainFrameAndVerifyMetrics(const std::string& url) { … }
SessionID LoadingPredictorTabHelperTest::GetTabID() { … }
void LoadingPredictorTabHelperTest::NavigateAndCommitInFrame(
const std::string& url,
content::RenderFrameHost* rfh) { … }
TEST_F(LoadingPredictorTabHelperTest, MainFrameNavigation) { … }
TEST_F(LoadingPredictorTabHelperTest, MainFrameNavigationWithRedirects) { … }
TEST_F(LoadingPredictorTabHelperTest, SubframeNavigation) { … }
TEST_F(LoadingPredictorTabHelperTest, MainFrameNavigationFailed) { … }
TEST_F(LoadingPredictorTabHelperTest, MainFrameNavigationSameDocument) { … }
TEST_F(LoadingPredictorTabHelperTest, DocumentOnLoadCompleted) { … }
TEST_F(LoadingPredictorTabHelperTest, ResourceLoadComplete) { … }
TEST_F(LoadingPredictorTabHelperTest, ResourceLoadCompleteInSubFrame) { … }
TEST_F(LoadingPredictorTabHelperTest, LoadResourceFromMemoryCache) { … }
class LoadingPredictorTabHelperOptimizationGuideDeciderTest
: public LoadingPredictorTabHelperTest { … };
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
DocumentOnLoadCompletedOptimizationGuideSameOrigin) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
DocumentOnLoadCompletedOptimizationGuide) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuide) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionComesAfterCommit) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionArrivedAfterRedirect) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionHasNotArrived) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionComesAfterPageDestroyed) { … }
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionArrivedNoPrediction) { … }
TEST_F(
LoadingPredictorTabHelperOptimizationGuideDeciderTest,
PageDestroyedOptimizationGuidePredictionArrivedNoLoadingPredictorMetadata) { … }
class LoadingPredictorTabHelperOptimizationGuideDeciderWithPrefetchTest
: public LoadingPredictorTabHelperOptimizationGuideDeciderTest { … };
TEST_F(LoadingPredictorTabHelperOptimizationGuideDeciderWithPrefetchTest,
PageDestroyedOptimizationGuide) { … }
class TestLoadingDataCollector : public LoadingDataCollector { … };
TestLoadingDataCollector::TestLoadingDataCollector(
const LoadingPredictorConfig& config)
: … { … }
class LoadingPredictorTabHelperTestCollectorTest
: public LoadingPredictorTabHelperTest { … };
void LoadingPredictorTabHelperTestCollectorTest::SetUp() { … }
TEST_F(LoadingPredictorTabHelperTestCollectorTest, ResourceLoadComplete) { … }
class LoadingPredictorTabHelperTestCollectorFencedFramesTest
: public LoadingPredictorTabHelperTestCollectorTest { … };
TEST_F(LoadingPredictorTabHelperTestCollectorFencedFramesTest,
DoNotRecordResourceLoadComplete) { … }
}