#include "chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history_embeddings/history_embeddings_service_factory.h"
#include "chrome/browser/optimization_guide/mock_optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/browser/page_content_annotations/page_content_annotations_service_factory.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/history_embeddings/answerer.h"
#include "components/history_embeddings/history_embeddings_features.h"
#include "components/history_embeddings/history_embeddings_service.h"
#include "components/page_content_annotations/core/test_page_content_annotations_service.h"
#include "components/user_education/test/mock_feature_promo_controller.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/time_format.h"
#include "ui/webui/resources/cr_components/history_embeddings/history_embeddings.mojom.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/constants/chromeos_features.h"
#endif
namespace {
class MockPage : public history_embeddings::mojom::Page { … };
}
std::unique_ptr<KeyedService> BuildTestHistoryEmbeddingsService(
content::BrowserContext* browser_context) { … }
std::unique_ptr<KeyedService> BuildTestPageContentAnnotationsService(
content::BrowserContext* browser_context) { … }
std::unique_ptr<KeyedService> BuildTestOptimizationGuideKeyedService(
content::BrowserContext* browser_context) { … }
class HistoryEmbeddingsHandlerTest : public BrowserWithTestWindowTest { … };
TEST_F(HistoryEmbeddingsHandlerTest, Searches) { … }
TEST_F(HistoryEmbeddingsHandlerTest, FormatsMojoResults) { … }
TEST_F(HistoryEmbeddingsHandlerTest, RecordsMetrics) { … }
TEST_F(HistoryEmbeddingsHandlerTest, ShowsPromo) { … }