chromium/components/omnibox/browser/history_quick_provider_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/omnibox/browser/history_quick_provider.h"

#include <stddef.h>

#include <functional>
#include <memory>
#include <set>
#include <string>
#include <vector>

#include "base/containers/to_vector.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/history/core/browser/history_backend.h"
#include "components/history/core/browser/history_database.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/test/history_service_test_util.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/fake_autocomplete_provider_client.h"
#include "components/omnibox/browser/history_test_util.h"
#include "components/omnibox/browser/history_url_provider.h"
#include "components/omnibox/browser/omnibox_triggered_feature_service.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/template_url_starter_pack_data.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
#include "third_party/metrics_proto/omnibox_focus_type.pb.h"

ASCIIToUTF16;

namespace {

// Waits for OnURLsDeletedNotification and when run quits the supplied run loop.
class WaitForURLsDeletedObserver : public history::HistoryServiceObserver {};

WaitForURLsDeletedObserver::WaitForURLsDeletedObserver(base::RunLoop* runner)
    :{}

WaitForURLsDeletedObserver::~WaitForURLsDeletedObserver() = default;

void WaitForURLsDeletedObserver::OnHistoryDeletions(
    history::HistoryService* service,
    const history::DeletionInfo& deletion_info) {}

void WaitForURLsDeletedNotification(history::HistoryService* history_service) {}

// Post history_backend->GetURL() to the history thread and stop the originating
// thread's message loop when done.
class GetURLTask : public history::HistoryDBTask {};

}  // namespace

class HistoryQuickProviderTest : public testing::Test {};

void HistoryQuickProviderTest::SetUp() {}

void HistoryQuickProviderTest::TearDown() {}

std::vector<HistoryQuickProviderTest::TestURLInfo>
HistoryQuickProviderTest::GetTestData() {}

void HistoryQuickProviderTest::FillData() {}

HistoryQuickProviderTest::SetShouldContain::SetShouldContain(
    const ACMatches& matched_urls) {}

void HistoryQuickProviderTest::SetShouldContain::operator()(
    const std::string& expected) {}

void HistoryQuickProviderTest::RunTest(
    const std::u16string& text,
    bool prevent_inline_autocomplete,
    const std::vector<std::string>& expected_urls,
    bool expected_can_inline_top_result,
    const std::u16string& expected_fill_into_edit,
    const std::u16string& expected_autocompletion) {}

void HistoryQuickProviderTest::RunTestWithCursor(
    const std::u16string& text,
    const size_t cursor_position,
    bool prevent_inline_autocomplete,
    const std::vector<std::string>& expected_urls,
    bool expected_can_inline_top_result,
    const std::u16string& expected_fill_into_edit,
    const std::u16string& expected_autocompletion,
    bool duplicates_ok) {}

bool HistoryQuickProviderTest::GetURLProxy(const GURL& url) {}

TEST_F(HistoryQuickProviderTest, SimpleSingleMatch) {}

TEST_F(HistoryQuickProviderTest, SingleMatchWithCursor) {}

TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak) {}

TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak_Dedupe) {}

TEST_F(HistoryQuickProviderTest,
       MatchWithAndWithoutCursorWordBreak_DedupingKeepsHigherScoredSuggestion) {}

TEST_F(HistoryQuickProviderTest, WordBoundariesWithPunctuationMatch) {}

TEST_F(HistoryQuickProviderTest, MultiTermTitleMatch) {}

TEST_F(HistoryQuickProviderTest, NonWordLastCharacterMatch) {}

TEST_F(HistoryQuickProviderTest, MultiMatch) {}

TEST_F(HistoryQuickProviderTest, StartRelativeMatch) {}

TEST_F(HistoryQuickProviderTest, EncodingMatch) {}

TEST_F(HistoryQuickProviderTest, ContentsClass) {}

TEST_F(HistoryQuickProviderTest, VisitCountMatches) {}

TEST_F(HistoryQuickProviderTest, TypedCountMatches) {}

TEST_F(HistoryQuickProviderTest, DaysAgoMatches) {}

TEST_F(HistoryQuickProviderTest, EncodingLimitMatch) {}

TEST_F(HistoryQuickProviderTest, Spans) {}

TEST_F(HistoryQuickProviderTest, DeleteMatch) {}

TEST_F(HistoryQuickProviderTest, PreventBeatingURLWhatYouTypedMatch) {}

TEST_F(HistoryQuickProviderTest, PreventInlineAutocomplete) {}

TEST_F(HistoryQuickProviderTest, DoesNotProvideMatchesOnFocus) {}

ScoredHistoryMatch BuildScoredHistoryMatch(const std::string& url_text,
                                           const std::u16string& input_term) {}

// Trim the http:// scheme from the contents in the general case.
TEST_F(HistoryQuickProviderTest, DoTrimHttpScheme) {}

// Don't trim the http:// scheme from the match contents if
// the user input included a scheme.
TEST_F(HistoryQuickProviderTest, DontTrimHttpSchemeIfInputHasScheme) {}

// Don't trim the http:// scheme from the match contents if
// the user input matched it.
TEST_F(HistoryQuickProviderTest, DontTrimHttpSchemeIfInputMatches) {}

// Don't trim the https:// scheme from the match contents if the user input
// included a scheme.
TEST_F(HistoryQuickProviderTest, DontTrimHttpsSchemeIfInputHasScheme) {}

// Trim the https:// scheme from the match contents if nothing prevents it.
TEST_F(HistoryQuickProviderTest, DoTrimHttpsScheme) {}

TEST_F(HistoryQuickProviderTest, CorrectAutocompleteWithTrailingSlash) {}

TEST_F(HistoryQuickProviderTest, KeywordModeExtractUserInput) {}

TEST_F(HistoryQuickProviderTest,
       QuickMatchToACMatch_HideUrlForDocumentSuggestion) {}

TEST_F(HistoryQuickProviderTest, MaxMatches) {}

class HQPDomainSuggestionsTest : public HistoryQuickProviderTest {};

TEST_F(HQPDomainSuggestionsTest, DomainSuggestions) {}

// HQPOrderingTest -------------------------------------------------------------

class HQPOrderingTest : public HistoryQuickProviderTest {};

std::vector<HistoryQuickProviderTest::TestURLInfo>
HQPOrderingTest::GetTestData() {}

TEST_F(HQPOrderingTest, TEMatch) {}

TEST_F(HQPOrderingTest, TEAMatch) {}