chromium/components/segmentation_platform/internal/execution/processing/uma_feature_processor_unittest.cc

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

#include "components/segmentation_platform/internal/execution/processing/uma_feature_processor.h"

#include <memory>

#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/metrics_hashes.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "base/test/test_file_util.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "components/segmentation_platform/internal/database/signal_database.h"
#include "components/segmentation_platform/internal/database/signal_database_impl.h"
#include "components/segmentation_platform/internal/database/signal_storage_config.h"
#include "components/segmentation_platform/internal/database/storage_service.h"
#include "components/segmentation_platform/internal/database/ukm_database.h"
#include "components/segmentation_platform/internal/database/ukm_database_backend.h"
#include "components/segmentation_platform/internal/database/ukm_types.h"
#include "components/segmentation_platform/internal/execution/processing/feature_aggregator_impl.h"
#include "components/segmentation_platform/internal/execution/processing/feature_list_query_processor.h"
#include "components/segmentation_platform/internal/execution/processing/feature_processor_state.h"
#include "components/segmentation_platform/internal/execution/processing/query_processor.h"
#include "components/segmentation_platform/internal/metadata/metadata_writer.h"
#include "components/segmentation_platform/internal/mock_ukm_data_manager.h"
#include "components/segmentation_platform/internal/proto/signal.pb.h"
#include "components/segmentation_platform/public/features.h"
#include "components/segmentation_platform/public/proto/model_metadata.pb.h"
#include "feature_aggregator.h"
#include "sql/database.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace segmentation_platform::processing {

constexpr char kProfileId[] =;
constexpr std::array<int32_t, 2> kEnumHistorgram0And1{};

constexpr MetadataWriter::UMAFeature kEnumRecorded4Times =;
constexpr MetadataWriter::UMAFeature kEnumRecorded4TimesAsValue =;

constexpr MetadataWriter::UMAFeature kUserActionTwice =;

constexpr MetadataWriter::UMAFeature kUserActionOnce =;

constexpr MetadataWriter::UMAFeature kValueHistogram =;

constexpr MetadataWriter::UMAFeature kEnumHistogramNotRecorded =;

constexpr MetadataWriter::UMAFeature kUserActionNotRecorded =;

constexpr std::array<MetadataWriter::UMAFeature, 7> kUMAFeatures =;

class UmaFeatureProcessorTest : public testing::Test,
                                public ::testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(UmaFeatureProcessorTest, ProcessEnumFeature) {}

constexpr std::array<int32_t, 1> kEnumHistorgram4{};
constexpr MetadataWriter::UMAFeature kEnumValueNotRecorded =;

TEST_P(UmaFeatureProcessorTest, ProcessEnumWithUnrecordedValues) {}

TEST_P(UmaFeatureProcessorTest, ProcessUserAction) {}

TEST_P(UmaFeatureProcessorTest, ProcessValue) {}

TEST_P(UmaFeatureProcessorTest, ProcessWithNoData) {}

TEST_P(UmaFeatureProcessorTest, ProcessWithDatabase) {}

}  // namespace segmentation_platform::processing