chromium/components/variations/variations_layers_unittest.cc

// Copyright 2024 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/variations/variations_layers.h"

#include <sys/types.h>

#include <cstdint>
#include <limits>
#include <vector>

#include "base/test/metrics/histogram_tester.h"
#include "components/variations/entropy_provider.h"
#include "components/variations/processed_study.h"
#include "components/variations/proto/layer.pb.h"
#include "components/variations/proto/study.pb.h"
#include "components/variations/proto/variations_seed.pb.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace variations {

namespace {

const uint32_t kLayerId =;
const uint32_t kLayerMemberId =;

// If CreateSeedWithLimitedLayer() is used to constructed the layer and the
// seed, the following values are picked so that a particular slot can be
// selected. This is used to catch any error if the entropy provider is not
// selected based on the entropy mode.
const uint32_t kTestLowEntropySource =;    // Will select slot 49.
const char kTestClientID[] =;  // Will select slot 99.
const char kTestLimitedEntropyRandomizationSource[] =;  // Will select slot 0.

struct LayerMemberSpec {};

struct LayerSpec {};

struct StudySpec {};

struct SeedSpec {};

const LayerMemberSpec kSingleSlotLayerMember =;

Layer CreateLayer(const LayerSpec spec) {}

// Creates a layer with a single 100% layer member.
Layer CreateSimpleLayer(Layer::EntropyMode entropy_mode) {}

// Adds an experiment with the given name and probability to a study.
Study::Experiment* AddExperiment(const std::string& name,
                                 uint32_t probability,
                                 Study* study) {}

Study CreateStudy(const StudySpec& spec) {}

LayerMemberReference CreateLayerMemberReference(
    uint32_t layer_id,
    const std::vector<uint32_t>& layer_member_ids) {}

// Creates a study with the given `consistency`, and two 50% groups.
Study CreateTwoArmStudy(Study_Consistency consistency) {}

// Adds a google_web_experiment_id to each experiment in the given `study`. The
// first experiments will use 100001, the second 100002, and so on.
void AddGoogleExperimentIds(Study* study) {}

void ConstrainToLayer(Study* study,
                      const LayerMemberReference& layer_member_reference) {}

VariationsSeed CreateSeed(const SeedSpec& spec) {}

// Creates a seed that contains the given study constrained to a layer with the
// given entropy mode. This will modify the given study to be layer constrained,
// but returned seed will have a copy of the modified study.
VariationsSeed CreateSeedWithLayerConstrainedStudy(
    Layer::EntropyMode layer_entropy_mode,
    Study* study_to_be_constrained) {}

VariationsSeed CreateSeedWithLimitedLayer() {}

enum EntropyProviderSelection {};

class FakeEntropyProviders : public EntropyProviders {};

}  // namespace

class VariationsLayersTest : public ::testing::Test {};

TEST_F(VariationsLayersTest, LayersHaveDuplicatedID) {}

TEST_F(VariationsLayersTest, LayersAllHaveUniqueIDs) {}

TEST_F(VariationsLayersTest, ValidLimitedLayer) {}

TEST_F(VariationsLayersTest, InvalidLayer_LimitedLayerDropped) {}

TEST_F(VariationsLayersTest, ValidSlotBounds) {}

TEST_F(VariationsLayersTest, InvalidSlotBounds_ReferringToOutOfBoundsSlot) {}

TEST_F(VariationsLayersTest, UniqueLayerMemberIDs) {}

TEST_F(VariationsLayersTest, DuplicatedLayerMemberIDs) {}

TEST_F(VariationsLayersTest, LowEntropyStudy) {}

TEST_F(VariationsLayersTest, HighEntropyStudy) {}

TEST_F(VariationsLayersTest, StudyConstrainedToLowEntropyLayer) {}

TEST_F(VariationsLayersTest, StudyConstrainedToLimitedEntropyLayer) {}

TEST_F(VariationsLayersTest, StudyConstrainedToDefaultEntropyLayer) {}

TEST_F(VariationsLayersTest, StudyEntropyProviderSelection_SelectLowEntropy) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_SelectSessionEntropy) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_SelectDefaultEntropy) {}

TEST_F(VariationsLayersTest, StudyEntropyProviderSelection_NoHighEntropyValue) {}

TEST_F(
    VariationsLayersTest,
    StudyEntropyProviderSelection_NoHighEntropy_ConstrainedToHighEntropyLayer) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_HighEntropyStudyInHighEntropyLayer) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_LowEntropyStudyInLowEntropyLayer) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_HighEntropyStudyInLowEntropyLayer) {}

TEST_F(VariationsLayersTest,
       StudyEntropyProviderSelection_LimitedEntropyStudyInLimitedEntropyLayer) {}

TEST_F(
    VariationsLayersTest,
    StudyEntropyProviderSelection_NonLimitedEntropyStudyInLimitedEntropyLayer) {}

TEST_F(VariationsLayersTest, StudyEntropyProviderSelection_NoLimitedSource) {}

TEST_F(VariationsLayersTest, IsReferencingLayerMemberId_IncludeLayerMembers) {}

TEST_F(VariationsLayersTest,
       IsReferencingLayerMemberId_IncludeLayerMembers_LegacyField) {}

TEST_F(VariationsLayersTest, IsReferencingLayerMemberId_NoLayerMembers) {}

}  // namespace variations