#include "chrome/browser/predictors/loading_predictor.h"
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/predictors/loading_test_util.h"
#include "chrome/browser/preloading/preloading_prefs.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "net/base/network_anonymization_key.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
_;
Return;
StrictMock;
DoAll;
SetArgPointee;
namespace predictors {
namespace {
const char kUrl[] = …;
const char kUrl2[] = …;
const char kUrl3[] = …;
class MockPreconnectManager : public PreconnectManager { … };
MockPreconnectManager::MockPreconnectManager(base::WeakPtr<Delegate> delegate,
Profile* profile)
: … { … }
LoadingPredictorConfig CreateConfig() { … }
net::NetworkAnonymizationKey CreateNetworkanonymization_key(
const GURL& main_frame_url) { … }
NavigationId GetNextId() { … }
}
class LoadingPredictorTest : public testing::Test { … };
LoadingPredictorTest::~LoadingPredictorTest() = default;
void LoadingPredictorTest::SetUp() { … }
void LoadingPredictorTest::TearDown() { … }
void LoadingPredictorTest::SetPreference() { … }
class LoadingPredictorPreconnectTest : public LoadingPredictorTest { … };
void LoadingPredictorPreconnectTest::SetUp() { … }
void LoadingPredictorPreconnectTest::TearDown() { … }
void LoadingPredictorPreconnectTest::SetPreference() { … }
TEST_F(LoadingPredictorTest, TestOnNavigationStarted) { … }
TEST_F(LoadingPredictorTest, TestMainFrameResponseCancelsHint) { … }
TEST_F(LoadingPredictorTest, TestMainFrameResponseClearsNavigations) { … }
TEST_F(LoadingPredictorTest, TestMainFrameRequestDoesntCancelExternalHint) { … }
TEST_F(LoadingPredictorTest, TestDuplicateHintAfterPreconnectCompleteCalled) { … }
TEST_F(LoadingPredictorTest,
TestDuplicateHintAfterPreconnectCompleteNotCalled) { … }
TEST_F(LoadingPredictorTest, TestDontTrackNonPrefetchableUrls) { … }
TEST_F(LoadingPredictorTest, TestDontPredictOmniboxHints) { … }
TEST_F(LoadingPredictorPreconnectTest, TestHandleOmniboxHint) { … }
TEST_F(LoadingPredictorPreconnectTest, TestAddInitialUrlToEmptyPrediction) { … }
TEST_F(LoadingPredictorPreconnectTest, TestAddInitialUrlMatchesPrediction) { … }
TEST_F(LoadingPredictorPreconnectTest, TestAddInitialUrlDoesntMatchPrediction) { … }
TEST_F(LoadingPredictorPreconnectTest, TestAddInvalidInitialUrl) { … }
TEST_F(LoadingPredictorPreconnectTest,
TestPrepareForPageLoadPredictionProvided) { … }
TEST_F(LoadingPredictorPreconnectTest,
TestPrepareForPageLoadPredictionWithEmptyRequestsProvided) { … }
TEST_F(LoadingPredictorPreconnectTest,
TestPrepareForPageLoadPreconnectsUsingPredictionWhenNoLocalPrediction) { … }
TEST_F(
LoadingPredictorPreconnectTest,
TestPrepareForPageLoadPredictionProvidedButHasLocalPreconnectPrediction) { … }
TEST_F(LoadingPredictorPreconnectTest, TestHandleHintWithOpaqueOrigins) { … }
TEST_F(LoadingPredictorPreconnectTest, TestHandleHintWhenOnlyHttpsAllowed) { … }
TEST_F(LoadingPredictorPreconnectTest,
TestHandleHintPreresolveWhenOnlyHttpsAllowed) { … }
}