#include "components/omnibox/browser/url_scoring_signals_annotator.h"
#include <optional>
#include <string>
#include <vector>
#include "components/history/core/browser/url_row.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/autocomplete_result.h"
#include "components/omnibox/browser/autocomplete_scoring_signals_annotator.h"
#include "components/omnibox/browser/test_scheme_classifier.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
#include "third_party/metrics_proto/omnibox_scoring_signals.pb.h"
#include "url/gurl.h"
ScoringSignals;
namespace {
AutocompleteMatch CreateUrlAutocompleteMatch(
const std::string& url_text,
AutocompleteMatchType::Type type = AutocompleteMatchType::HISTORY_URL) { … }
ScoringSignals CreateUrlMatchingScoringSignals(
bool is_host_only,
size_t length_of_url,
std::optional<size_t> first_url_match_position,
std::optional<bool> host_match_at_word_boundary,
std::optional<bool> has_non_scheme_www_match,
size_t total_url_match_length,
size_t total_host_match_length,
size_t total_path_match_length,
size_t total_query_or_ref_match_length,
size_t num_input_terms_matched_by_url,
bool allowed_to_be_default_match) { … }
}
class UrlScoringSignalsAnnotatorTest : public testing::Test { … };
void UrlScoringSignalsAnnotatorTest::CompareScoringSignals(
const ScoringSignals& scoring_signals,
const ScoringSignals& expected_scoring_signals) { … }
TEST_F(UrlScoringSignalsAnnotatorTest, AnnotateResultHostOnly) { … }
TEST_F(UrlScoringSignalsAnnotatorTest, AnnotateResultUrlWithPath) { … }
TEST_F(UrlScoringSignalsAnnotatorTest, AnnotateResultPathMatchOnly) { … }
TEST_F(UrlScoringSignalsAnnotatorTest, AnnotateResultWWWOnly) { … }