#include "components/omnibox/browser/autocomplete_match.h"
#include <stddef.h>
#include <utility>
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/omnibox/browser/actions/omnibox_action.h"
#include "components/omnibox/browser/actions/omnibox_action_in_suggest.h"
#include "components/omnibox/browser/actions/omnibox_answer_action.h"
#include "components/omnibox/browser/actions/omnibox_pedal.h"
#include "components/omnibox/browser/actions/omnibox_pedal_concepts.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/autocomplete_provider.h"
#include "components/omnibox/browser/fake_autocomplete_provider.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/test_scheme_classifier.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_starter_pack_data.h"
#include "testing/gmock/include/gmock/gmock.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 "third_party/omnibox_proto/entity_info.pb.h"
#include "ui/gfx/vector_icon_types.h"
#include "url/gurl.h"
ScoringSignals;
namespace {
class FakeOmniboxAction : public OmniboxAction { … };
void TestSetAllowedToBeDefault(int caseI,
const std::string input_text,
bool input_prevent_inline_autocomplete,
const std::string match_inline_autocompletion,
const std::string match_prefix_autocompletion,
const std::string expected_inline_autocompletion,
bool expected_allowed_to_be_default_match) { … }
AutocompleteMatch CreateACMatchWithScoringSignals(
int typed_count,
int visit_count,
int elapsed_time_last_visit_secs,
int shortcut_visit_count,
int shortest_shortcut_len,
bool is_host_only,
int num_bookmarks_of_url,
int first_bookmark_title_match_position,
int total_bookmark_title_match_length,
int num_input_terms_matched_by_bookmark_title,
int first_url_match_position,
int total_url_match_length,
bool host_match_at_word_boundary,
int total_path_match_length,
int total_query_or_ref_match_length,
int total_title_match_length,
bool has_non_scheme_www_match,
int num_input_terms_matched_by_title,
int num_input_terms_matched_by_url,
int length_of_url,
float site_engagement,
bool allowed_to_be_default_match) { … }
class AutocompleteMatchTest : public testing::Test { … };
}
TEST_F(AutocompleteMatchTest, MoreRelevant) { … }
TEST_F(AutocompleteMatchTest, MergeClassifications) { … }
TEST_F(AutocompleteMatchTest, GetMatchComponents) { … }
TEST_F(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) { … }
TEST_F(AutocompleteMatchTest, SupportsDeletion) { … }
struct DuplicateCase { … };
void CheckDuplicateCase(const DuplicateCase& duplicate_case) { … }
TEST_F(AutocompleteMatchTest, Duplicates) { … }
TEST_F(AutocompleteMatchTest, DedupeDriveURLs) { … }
TEST_F(AutocompleteMatchTest, UpgradeMatchWithPropertiesFrom) { … }
TEST_F(AutocompleteMatchTest, MergeScoringSignals) { … }
TEST_F(AutocompleteMatchTest, SetAllowedToBeDefault) { … }
TEST_F(AutocompleteMatchTest, SetAllowedToBeDefault_PrefixAutocompletion) { … }
TEST_F(AutocompleteMatchTest, TryRichAutocompletion) { … }
TEST_F(AutocompleteMatchTest, TryRichAutocompletionShortcutText) { … }
TEST_F(AutocompleteMatchTest, BetterDuplicate) { … }
TEST_F(AutocompleteMatchTest, FilterOmniboxActions) { … }
TEST_F(AutocompleteMatchTest, RearrangeActionsInSuggest) { … }
#if (!BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !BUILDFLAG(IS_IOS)
TEST_F(AutocompleteMatchTest, ValidateGetVectorIcons) { … }
#endif
TEST_F(AutocompleteMatchTest, IsClipboardType) { … }