| Index: chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc
|
| diff --git a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc
|
| index f7a5b06da105f7ce69e91488c137529cdf1899e4..a2b1cb53244381668d2e7a4fc44d489eb8c77a53 100644
|
| --- a/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc
|
| +++ b/chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc
|
| @@ -7,50 +7,46 @@
|
| #include <map>
|
| #include <string>
|
|
|
| -#include "base/metrics/field_trial.h"
|
| #include "base/win/windows_version.h"
|
| -#include "components/variations/variations_associated_data.h"
|
| +#include "components/variations/variations_params_manager.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace safe_browsing {
|
|
|
| class SRTDownloadURLTest : public ::testing::Test {
|
| protected:
|
| - void SetUp() override {
|
| - field_trial_list_ = std::make_unique<base::FieldTrialList>(nullptr);
|
| + void CreatePromptTrial(const std::string& experiment_name) {
|
| + // Assigned trials will go out of scope when variations_ goes out of scope.
|
| + constexpr char kTrialName[] = "SRTPromptFieldTrial";
|
| + base::FieldTrialList::CreateFieldTrial(kTrialName, experiment_name);
|
| }
|
|
|
| - void CreatePromptTrial(const std::string& experiment_name,
|
| - const std::string& download_group) {
|
| + void CreateDownloadFeature(const std::string& download_group_name) {
|
| + constexpr char kFeatureName[] = "DownloadCleanupToolByBitness";
|
| std::map<std::string, std::string> params;
|
| - if (!download_group.empty())
|
| - params["download_group"] = download_group;
|
| -
|
| - // Assigned trials will go out of scope when field_trial_list_ goes out
|
| - // of scope.
|
| - constexpr char kTrialName[] = "SRTPromptFieldTrial";
|
| - variations::AssociateVariationParams(kTrialName, experiment_name, params);
|
| - base::FieldTrialList::CreateFieldTrial(kTrialName, experiment_name);
|
| + params["download_group"] = download_group_name;
|
| + variations_.SetVariationParamsWithFeatureAssociations(
|
| + "A trial name", params, {kFeatureName});
|
| }
|
|
|
| private:
|
| - std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
| + variations::testing::VariationParamsManager variations_;
|
| };
|
|
|
| TEST_F(SRTDownloadURLTest, Stable) {
|
| - CreatePromptTrial("On", "");
|
| + CreatePromptTrial("On");
|
| EXPECT_EQ("/dl/softwareremovaltool/win/chrome_cleanup_tool.exe",
|
| GetSRTDownloadURL().path());
|
| }
|
|
|
| TEST_F(SRTDownloadURLTest, Canary) {
|
| - CreatePromptTrial("SRTCanary", "");
|
| + CreatePromptTrial("SRTCanary");
|
| EXPECT_EQ("/dl/softwareremovaltool/win/c/chrome_cleanup_tool.exe",
|
| GetSRTDownloadURL().path());
|
| }
|
|
|
| TEST_F(SRTDownloadURLTest, Experiment) {
|
| - CreatePromptTrial("Experiment", "experiment");
|
| + CreateDownloadFeature("experiment");
|
| std::string expected_path;
|
| if (base::win::OSInfo::GetInstance()->architecture() ==
|
| base::win::OSInfo::X86_ARCHITECTURE) {
|
|
|