#include "components/page_info/core/about_this_site_service.h"
#include <memory>
#include <string_view>
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "components/optimization_guide/core/optimization_guide_decision.h"
#include "components/optimization_guide/proto/common_types.pb.h"
#include "components/page_info/core/about_this_site_validation.h"
#include "components/page_info/core/features.h"
#include "components/page_info/core/proto/about_this_site_metadata.pb.h"
#include "components/search_engines/prepopulated_engines.h"
#include "components/search_engines/search_engines_test_environment.h"
#include "components/search_engines/template_url_service.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace page_info {
_;
Invoke;
Return;
AboutThisSiteStatus;
AboutThisSiteInteraction;
DecisionWithMetadata;
OptimizationGuideDecision;
OptimizationMetadata;
class MockAboutThisSiteService : public AboutThisSiteService { … };
class MockTabHelper : public AboutThisSiteService::TabHelper { … };
proto::AboutThisSiteMetadata CreateValidMetadata() { … }
proto::AboutThisSiteMetadata CreateInvalidDescription() { … }
OptimizationGuideDecision ReturnDescription(const GURL& url,
OptimizationMetadata* metadata) { … }
OptimizationGuideDecision ReturnInvalidDescription(
const GURL& url,
OptimizationMetadata* metadata) { … }
OptimizationGuideDecision ReturnNoResult(const GURL& url,
OptimizationMetadata* metadata) { … }
OptimizationGuideDecision ReturnUnknown(const GURL& url,
OptimizationMetadata* metadata) { … }
class AboutThisSiteServiceTest : public ::testing::TestWithParam<bool> { … };
TEST_P(AboutThisSiteServiceTest, ValidResponse) { … }
TEST_P(AboutThisSiteServiceTest, FeatureCheck) { … }
TEST_P(AboutThisSiteServiceTest, InvalidResponse) { … }
TEST_P(AboutThisSiteServiceTest, NoResponse) { … }
TEST_P(AboutThisSiteServiceTest, Unknown) { … }
TEST_P(AboutThisSiteServiceTest, NotShownWhenNoGoogleDSE) { … }
TEST_P(AboutThisSiteServiceTest, LocalHosts) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigation) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigationWithAnchor) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigationWithPath) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigationInvalid) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigationInvalidBlank) { … }
TEST_P(AboutThisSiteServiceTest, CreateMoreAboutUrlForNavigationInvalidFile) { … }
INSTANTIATE_TEST_SUITE_P(…);
}