#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/variations/entropy_provider.h"
#include <stddef.h>
#include <stdint.h>
#include <cmath>
#include <limits>
#include <memory>
#include <numeric>
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/uuid.h"
#include "components/variations/hashing.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace variations {
namespace {
const uint32_t kMaxLowEntropySize = …;
const char* const kTestTrialNames[] = …;
double ComputeChiSquare(const std::vector<int>& values,
double expected_value) { … }
double GenerateSHA1Entropy(const std::string& entropy_source,
const std::string& trial_name) { … }
double GenerateNormalizedMurmurHashEntropy(ValueInRange entropy_source,
const std::string& trial_name) { … }
class TrialEntropyGenerator { … };
class SHA1EntropyGenerator : public TrialEntropyGenerator { … };
class NormalizedMurmurHashEntropyGenerator : public TrialEntropyGenerator { … };
void PerformEntropyUniformityTest(
const std::string& trial_name,
const TrialEntropyGenerator& entropy_generator) { … }
}
TEST(EntropyProviderTest, UseOneTimeRandomizationSHA1) { … }
TEST(EntropyProviderTest, UseOneTimeRandomizationNormalizedMurmurHash) { … }
TEST(EntropyProviderTest, UseOneTimeRandomizationWithCustomSeedSHA1) { … }
TEST(EntropyProviderTest,
UseOneTimeRandomizationWithCustomSeedNormalizedMurmurHash) { … }
TEST(EntropyProviderTest, SHA1Entropy) { … }
TEST(EntropyProviderTest, NormalizedMurmurHashEntropy) { … }
TEST(EntropyProviderTest, NormalizedMurmurHashEntropyProviderResults) { … }
TEST(EntropyProviderTest, SHA1EntropyIsUniform) { … }
TEST(EntropyProviderTest, NormalizedMurmurHashEntropyIsUniform) { … }
TEST(EntropyProviderTest, InstantiationWithLimitedEntropyRandomizationSource) { … }
TEST(EntropyProviderTest,
InstantiationWithLimitedEntropyRandomizationSourceAsEmptyString) { … }
}