#include "components/browsing_topics/test_util.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "components/history/core/browser/history_service.h"
#include "components/ukm/test_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
namespace browsing_topics {
std::vector<ApiResultUkmMetrics> ReadApiResultUkmMetrics(
const ukm::TestAutoSetUkmRecorder& ukm_recorder) { … }
bool BrowsingTopicsEligibleForURLVisit(history::HistoryService* history_service,
const GURL& url) { … }
TesterBrowsingTopicsCalculator::TesterBrowsingTopicsCalculator(
privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings,
history::HistoryService* history_service,
content::BrowsingTopicsSiteDataManager* site_data_manager,
Annotator* annotator,
int previous_timeout_count,
base::Time session_start_time,
const base::circular_deque<EpochTopics>& epochs,
CalculateCompletedCallback callback,
base::queue<uint64_t> rand_uint64_queue)
: … { … }
TesterBrowsingTopicsCalculator::TesterBrowsingTopicsCalculator(
privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings,
history::HistoryService* history_service,
content::BrowsingTopicsSiteDataManager* site_data_manager,
Annotator* annotator,
int previous_timeout_count,
base::Time session_start_time,
CalculateCompletedCallback callback,
EpochTopics mock_result,
base::TimeDelta mock_result_delay)
: … { … }
TesterBrowsingTopicsCalculator::~TesterBrowsingTopicsCalculator() = default;
uint64_t TesterBrowsingTopicsCalculator::GenerateRandUint64() { … }
void TesterBrowsingTopicsCalculator::CheckCanCalculate() { … }
void TesterBrowsingTopicsCalculator::MockDelayReached() { … }
MockBrowsingTopicsService::MockBrowsingTopicsService() = default;
MockBrowsingTopicsService::~MockBrowsingTopicsService() = default;
TestAnnotator::TestAnnotator() = default;
TestAnnotator::~TestAnnotator() = default;
void TestAnnotator::UseAnnotations(
const std::map<std::string, std::set<int32_t>>& annotations) { … }
void TestAnnotator::UseModelInfo(
const std::optional<optimization_guide::ModelInfo>& model_info) { … }
void TestAnnotator::SetModelAvailable(bool model_available) { … }
void TestAnnotator::BatchAnnotate(BatchAnnotationCallback callback,
const std::vector<std::string>& inputs) { … }
void TestAnnotator::NotifyWhenModelAvailable(base::OnceClosure callback) { … }
std::optional<optimization_guide::ModelInfo>
TestAnnotator::GetBrowsingTopicsModelInfo() const { … }
}