#include "content/public/test/preloading_test_util.h"
#include "base/strings/stringprintf.h"
#include "content/browser/preloading/preloading_attempt_impl.h"
#include "content/browser/preloading/preloading_config.h"
#include "content/browser/preloading/preloading_data_impl.h"
#include "preloading_test_util.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content::test {
UkmEntry;
Preloading_Attempt;
Preloading_Prediction;
const std::vector<std::string> kPreloadingAttemptUkmMetrics{ … };
const std::vector<std::string> kPreloadingPredictionUkmMetrics{ … };
PreloadingAttemptUkmEntryBuilder::PreloadingAttemptUkmEntryBuilder(
PreloadingPredictor predictor)
: … { … }
UkmEntry PreloadingAttemptUkmEntryBuilder::BuildEntry(
ukm::SourceId source_id,
PreloadingType preloading_type,
PreloadingEligibility eligibility,
PreloadingHoldbackStatus holdback_status,
PreloadingTriggeringOutcome triggering_outcome,
PreloadingFailureReason failure_reason,
bool accurate,
std::optional<base::TimeDelta> ready_time,
std::optional<blink::mojom::SpeculationEagerness> eagerness) const { … }
PreloadingPredictionUkmEntryBuilder::PreloadingPredictionUkmEntryBuilder(
PreloadingPredictor predictor)
: … { … }
UkmEntry PreloadingPredictionUkmEntryBuilder::BuildEntry(
ukm::SourceId source_id,
int64_t confidence,
bool accurate_prediction) const { … }
void ExpectPreloadingAttemptUkm(
ukm::TestAutoSetUkmRecorder& ukm_recorder,
const std::vector<ukm::TestUkmRecorder::HumanReadableUkmEntry>&
expected_attempt_entries) { … }
void ExpectPreloadingPredictionUkm(
ukm::TestAutoSetUkmRecorder& ukm_recorder,
const std::vector<ukm::TestUkmRecorder::HumanReadableUkmEntry>&
expected_prediction_entries) { … }
std::string UkmEntryToString(const UkmEntry& entry) { … }
std::string ActualVsExpectedUkmEntryToString(const UkmEntry& actual,
const UkmEntry& expected) { … }
std::string ActualVsExpectedUkmEntriesToString(
const std::vector<UkmEntry>& actual,
const std::vector<UkmEntry>& expected) { … }
PreloadingAttemptAccessor::PreloadingAttemptAccessor(
PreloadingAttempt* preloading_attempt)
: … { … }
PreloadingTriggeringOutcome PreloadingAttemptAccessor::GetTriggeringOutcome() { … }
PreloadingFailureReason PreloadingAttemptAccessor::GetFailureReason() { … }
PreloadingConfigOverride::PreloadingConfigOverride() { … }
PreloadingConfigOverride::~PreloadingConfigOverride() { … }
void PreloadingConfigOverride::SetHoldback(PreloadingType preloading_type,
PreloadingPredictor predictor,
bool holdback) { … }
void PreloadingConfigOverride::SetHoldback(std::string_view preloading_type,
std::string_view predictor,
bool holdback) { … }
void SetHasSpeculationRulesPrerender(PreloadingData* preloading_data) { … }
}