chromium/components/omnibox/browser/shortcuts_backend_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/shortcuts_backend.h"

#include <stddef.h>

#include <iterator>
#include <memory>

#include "base/files/scoped_temp_dir.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/history/core/browser/history_service.h"
#include "components/history/core/test/history_service_test_util.h"
#include "components/omnibox/browser/autocomplete_provider.h"
#include "components/omnibox/browser/fake_autocomplete_provider.h"
#include "components/omnibox/browser/shortcuts_constants.h"
#include "components/omnibox/browser/shortcuts_database.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/search_engines_test_environment.h"
#include "components/search_engines/search_terms_data.h"
#include "components/search_engines/template_url_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

// ShortcutsBackendTest -------------------------------------------------------

class ShortcutsBackendTest : public testing::Test,
                             public ShortcutsBackend::ShortcutsBackendObserver {};

ShortcutsBackendTest::ShortcutsBackendTest() = default;

ShortcutsDatabase::Shortcut::MatchCore
ShortcutsBackendTest::MatchCoreForTesting(const std::string& url,
                                          const std::string& contents_class,
                                          const std::string& description_class,
                                          AutocompleteMatch::Type type) {}

void ShortcutsBackendTest::SetSearchProvider() {}

void ShortcutsBackendTest::SetUp() {}

void ShortcutsBackendTest::TearDown() {}

void ShortcutsBackendTest::OnShortcutsLoaded() {}

void ShortcutsBackendTest::OnShortcutsChanged() {}

void ShortcutsBackendTest::InitBackend() {}

bool ShortcutsBackendTest::AddShortcut(
    const ShortcutsDatabase::Shortcut& shortcut) {}

bool ShortcutsBackendTest::UpdateShortcut(
    const ShortcutsDatabase::Shortcut& shortcut) {}

bool ShortcutsBackendTest::DeleteShortcutsWithURL(const GURL& url) {}

bool ShortcutsBackendTest::DeleteShortcutsWithIDs(
    const ShortcutsDatabase::ShortcutIDs& deleted_ids) {}

bool ShortcutsBackendTest::ShortcutExists(const std::u16string& terms) const {}

std::vector<std::u16string> ShortcutsBackendTest::ShortcutsMapTexts() const {}

void ShortcutsBackendTest::ClearShortcutsMap() {}

// Actual tests ---------------------------------------------------------------

// Verifies that creating MatchCores strips classifications and sanitizes match
// types.
TEST_F(ShortcutsBackendTest, SanitizeMatchCore) {}

TEST_F(ShortcutsBackendTest, EntitySuggestionTest) {}

TEST_F(ShortcutsBackendTest, MatchCoreDescriptionTest) {}

TEST_F(ShortcutsBackendTest, AddAndUpdateShortcut) {}

// Tests that zero suggest matches are not added to the database.
TEST_F(ShortcutsBackendTest, AddAndUpdateShortcut_ZeroSuggest) {}

TEST_F(ShortcutsBackendTest, DeleteShortcuts) {}

TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_3CharShortening) {}

TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_Expanding) {}

TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_Expanding_Prefix) {}

TEST_F(ShortcutsBackendTest, AddOrUpdateShortcut_Expanding_Case) {}