#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 = …;
const uint32_t kTestLowEntropySource = …;
const char kTestClientID[] = …;
const char kTestLimitedEntropyRandomizationSource[] = …;
struct LayerMemberSpec { … };
struct LayerSpec { … };
struct StudySpec { … };
struct SeedSpec { … };
const LayerMemberSpec kSingleSlotLayerMember = …;
Layer CreateLayer(const LayerSpec spec) { … }
Layer CreateSimpleLayer(Layer::EntropyMode entropy_mode) { … }
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) { … }
Study CreateTwoArmStudy(Study_Consistency consistency) { … }
void AddGoogleExperimentIds(Study* study) { … }
void ConstrainToLayer(Study* study,
const LayerMemberReference& layer_member_reference) { … }
VariationsSeed CreateSeed(const SeedSpec& spec) { … }
VariationsSeed CreateSeedWithLayerConstrainedStudy(
Layer::EntropyMode layer_entropy_mode,
Study* study_to_be_constrained) { … }
VariationsSeed CreateSeedWithLimitedLayer() { … }
enum EntropyProviderSelection { … };
class FakeEntropyProviders : public EntropyProviders { … };
}
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) { … }
}