// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <cstring> #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial.h" #include "components/variations/entropy_provider.h" #include "testing/gtest/include/gtest/gtest.h" // These tests mirror testSimulateTrialAssignments and // testSimulateTrialAssignmentsWithForcedSalt in the internal crosstalk_test.py. // Both places hard-code the same expected results, ensuring the chromium // implementation matches the Python implementation. namespace variations { namespace { AssignmentCounts; // These studies must match the ones in crosstalk_test.py. const char* const kDnsStudyName = …; const char* const kInstantStudyName = …; constexpr uint32_t kMaxLowEntropySize = …; scoped_refptr<base::FieldTrial> CreateDnsStudy(double value) { … } scoped_refptr<base::FieldTrial> CreateInstantStudy(double value) { … } // Simulate assigning users with every possible low entropy source to each // study. Populate |counts| such that count[x][y] is the number of users in both // DnsProbe-Attempts' group x and InstantExtended's group y. If |salt|, add salt // to InstantExtended's name. AssignmentCounts CountAssignments(bool salt) { … } } // namespace TEST(SimulateForCrosstalkTest, WithoutSalt) { … } TEST(SimulateForCrosstalkTest, WithSalt) { … } } // namespace variations