Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc

Issue 2949633002: Do not tie cleanup tool download to SRTPromptFieldTrial field trial (Closed)
Patch Set: Use newer API Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698