#include "components/browsing_topics/annotator_impl.h"
#include "base/containers/flat_map.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_model_provider.h"
#include "components/optimization_guide/core/test_model_info_builder.h"
#include "components/optimization_guide/core/test_optimization_guide_model_provider.h"
#include "components/optimization_guide/proto/models.pb.h"
#include "components/optimization_guide/proto/page_topics_model_metadata.pb.h"
#include "components/optimization_guide/proto/page_topics_override_list.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/zlib/google/compression_utils.h"
namespace browsing_topics {
namespace {
const int kTaxonomyVersionV2 = …;
const char kPageTopicsModelMetadataTypeUrl[] = …;
extern const int32_t kTopicsModelVersion = …;
class ModelObserverTracker
: public optimization_guide::TestOptimizationGuideModelProvider { … };
class TestAnnotatorImpl : public AnnotatorImpl { … };
class BrowsingTopicsAnnotatorImplTest : public testing::Test { … };
TEST_F(
BrowsingTopicsAnnotatorImplTest,
GetContentModelAnnotationsFromOutputNonNumericAndLowWeightCategoriesPruned) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest,
GetContentModelAnnotationsFromOutputNoneWeightTooStrong) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest,
GetContentModelAnnotationsFromOutputNoneInTopButNotStrongSoPruned) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest,
GetContentModelAnnotationsFromOutputPrunedAfterNormalization) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest, NoneCategoryBelowMinWeight) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest, HostPreprocessingV1) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest, HostPreprocessingV2) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest, PreprocessingNewVersion) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest,
SameTaxonomyVersions_ModelUpdateSuccess) { … }
TEST_F(BrowsingTopicsAnnotatorImplTest,
TaxonomyConfiguredVersion1ServerVersionEmpty_ModelUpdateSuccess) { … }
class BrowsingTopicsAnnotatorOverrideListTest
: public BrowsingTopicsAnnotatorImplTest { … };
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, FileDoesntExist) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, BadGzip) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, BadProto) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, SuccessCase) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, InputNotInOverride) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, ModelUnloadsOverrideList) { … }
TEST_F(BrowsingTopicsAnnotatorOverrideListTest, NewModelUnloadsOverrideList) { … }
}
}