Commit 35e2d490 authored by Bettina's avatar Bettina Committed by Commit Bot

Add experiment Switch for ResetShortcuts in CCT.

The new reset shortcut feature in the Chrome
Cleanup Tool needs a command line switch to tell it
whether or not the feature is on. The switch only
affects the cleaner and not the reporter.

Bug: 1116017
Change-Id: I8e3de8b1025a1471198991574859fdcf556e9aa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522679
Commit-Queue: Bettina Dea <bdea@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825187}
parent f78ad0db
...@@ -150,6 +150,10 @@ ChromeCleanerRunner::ChromeCleanerRunner( ...@@ -150,6 +150,10 @@ ChromeCleanerRunner::ChromeCleanerRunner(
cleaner_command_line_.AppendSwitchASCII( cleaner_command_line_.AppendSwitchASCII(
chrome_cleaner::kSRTPromptFieldTrialGroupNameSwitch, group_name); chrome_cleaner::kSRTPromptFieldTrialGroupNameSwitch, group_name);
} }
if (base::FeatureList::IsEnabled(kResetShortcutsFeature)) {
cleaner_command_line_.AppendSwitch(chrome_cleaner::kResetShortcutsSwitch);
}
} }
ChromeCleanerRunner::ProcessStatus ChromeCleanerRunner::ProcessStatus
......
...@@ -65,11 +65,13 @@ enum class ReporterEngine { ...@@ -65,11 +65,13 @@ enum class ReporterEngine {
// process running in scanning mode. // process running in scanning mode.
// - chrome_prompt (ChromePromptValue): indicates if this is a user-initiated // - chrome_prompt (ChromePromptValue): indicates if this is a user-initiated
// run or if the user was prompted. // run or if the user was prompted.
// - reset-shortcuts (bool): indicates reset shortcuts feature is enabled.
class ChromeCleanerRunnerSimpleTest class ChromeCleanerRunnerSimpleTest
: public testing::TestWithParam<std::tuple<ChromeMetricsStatus, : public testing::TestWithParam<std::tuple<ChromeMetricsStatus,
ReporterEngine, ReporterEngine,
bool, bool,
ChromePromptValue>>, ChromePromptValue,
bool>>,
public ChromeCleanerRunnerTestDelegate { public ChromeCleanerRunnerTestDelegate {
public: public:
ChromeCleanerRunnerSimpleTest() ChromeCleanerRunnerSimpleTest()
...@@ -77,7 +79,10 @@ class ChromeCleanerRunnerSimpleTest ...@@ -77,7 +79,10 @@ class ChromeCleanerRunnerSimpleTest
void SetUp() override { void SetUp() override {
std::tie(metrics_status_, reporter_engine_, cleaner_logs_enabled_, std::tie(metrics_status_, reporter_engine_, cleaner_logs_enabled_,
chrome_prompt_) = GetParam(); chrome_prompt_, reset_shortcuts_enabled_) = GetParam();
if (reset_shortcuts_enabled_)
scoped_feature_list_.InitAndEnableFeature(kResetShortcutsFeature);
SetChromeCleanerRunnerTestDelegateForTesting(this); SetChromeCleanerRunnerTestDelegateForTesting(this);
} }
...@@ -151,6 +156,7 @@ class ChromeCleanerRunnerSimpleTest ...@@ -151,6 +156,7 @@ class ChromeCleanerRunnerSimpleTest
ReporterEngine reporter_engine_; ReporterEngine reporter_engine_;
bool cleaner_logs_enabled_ = false; bool cleaner_logs_enabled_ = false;
ChromePromptValue chrome_prompt_ = ChromePromptValue::kUnspecified; ChromePromptValue chrome_prompt_ = ChromePromptValue::kUnspecified;
bool reset_shortcuts_enabled_ = false;
// Set by LaunchTestProcess. // Set by LaunchTestProcess.
base::CommandLine command_line_; base::CommandLine command_line_;
...@@ -160,6 +166,9 @@ class ChromeCleanerRunnerSimpleTest ...@@ -160,6 +166,9 @@ class ChromeCleanerRunnerSimpleTest
ChromeCleanerRunner::ProcessStatus process_status_; ChromeCleanerRunner::ProcessStatus process_status_;
base::RunLoop run_loop_; base::RunLoop run_loop_;
private:
base::test::ScopedFeatureList scoped_feature_list_;
}; };
TEST_P(ChromeCleanerRunnerSimpleTest, LaunchParams) { TEST_P(ChromeCleanerRunnerSimpleTest, LaunchParams) {
...@@ -197,6 +206,8 @@ TEST_P(ChromeCleanerRunnerSimpleTest, LaunchParams) { ...@@ -197,6 +206,8 @@ TEST_P(ChromeCleanerRunnerSimpleTest, LaunchParams) {
EXPECT_EQ( EXPECT_EQ(
command_line_.GetSwitchValueASCII(chrome_cleaner::kChromePromptSwitch), command_line_.GetSwitchValueASCII(chrome_cleaner::kChromePromptSwitch),
base::NumberToString(static_cast<int>(chrome_prompt_))); base::NumberToString(static_cast<int>(chrome_prompt_)));
EXPECT_EQ(reset_shortcuts_enabled_,
command_line_.HasSwitch(chrome_cleaner::kResetShortcutsSwitch));
} }
INSTANTIATE_TEST_SUITE_P(All, INSTANTIATE_TEST_SUITE_P(All,
...@@ -208,7 +219,8 @@ INSTANTIATE_TEST_SUITE_P(All, ...@@ -208,7 +219,8 @@ INSTANTIATE_TEST_SUITE_P(All,
ReporterEngine::kNewEngine), ReporterEngine::kNewEngine),
Bool(), Bool(),
Values(ChromePromptValue::kPrompted, Values(ChromePromptValue::kPrompted,
ChromePromptValue::kUserInitiated))); ChromePromptValue::kUserInitiated),
Bool()));
typedef std::tuple<UwsFoundStatus, typedef std::tuple<UwsFoundStatus,
ExtensionCleaningFeatureStatus, ExtensionCleaningFeatureStatus,
......
...@@ -42,6 +42,9 @@ const base::Feature kChromeCleanupDistributionFeature{ ...@@ -42,6 +42,9 @@ const base::Feature kChromeCleanupDistributionFeature{
const base::Feature kChromeCleanupExtensionsFeature{ const base::Feature kChromeCleanupExtensionsFeature{
"ChromeCleanupExtensions", base::FEATURE_DISABLED_BY_DEFAULT}; "ChromeCleanupExtensions", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kResetShortcutsFeature{"ChromeCleanupResetShortcuts",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsSRTPromptFeatureEnabled() { bool IsSRTPromptFeatureEnabled() {
return base::FeatureList::IsEnabled(kChromeCleanupInBrowserPromptFeature); return base::FeatureList::IsEnabled(kChromeCleanupInBrowserPromptFeature);
} }
......
...@@ -64,6 +64,10 @@ extern const base::Feature kChromeCleanupDistributionFeature; ...@@ -64,6 +64,10 @@ extern const base::Feature kChromeCleanupDistributionFeature;
// for, and cleanup, bad extensions. // for, and cleanup, bad extensions.
extern const base::Feature kChromeCleanupExtensionsFeature; extern const base::Feature kChromeCleanupExtensionsFeature;
// Reset shortcuts feature. When enabled, Chrome Cleaner will reset all Chrome
// shortcuts for the current Windows users.
extern const base::Feature kResetShortcutsFeature;
// Returns true if this Chrome is in a field trial group which shows the SRT // Returns true if this Chrome is in a field trial group which shows the SRT
// prompt. // prompt.
bool IsSRTPromptFeatureEnabled(); bool IsSRTPromptFeatureEnabled();
......
...@@ -21,6 +21,7 @@ const char kExecutionModeSwitch[] = "execution-mode"; ...@@ -21,6 +21,7 @@ const char kExecutionModeSwitch[] = "execution-mode";
const char kExtendedSafeBrowsingEnabledSwitch[] = const char kExtendedSafeBrowsingEnabledSwitch[] =
"extended-safebrowsing-enabled"; "extended-safebrowsing-enabled";
const char kRegistrySuffixSwitch[] = "registry-suffix"; const char kRegistrySuffixSwitch[] = "registry-suffix";
const char kResetShortcutsSwitch[] = "reset-shortcuts";
const char kSessionIdSwitch[] = "session-id"; const char kSessionIdSwitch[] = "session-id";
const char kSRTPromptFieldTrialGroupNameSwitch[] = "srt-field-trial-group-name"; const char kSRTPromptFieldTrialGroupNameSwitch[] = "srt-field-trial-group-name";
const char kUmaUserSwitch[] = "uma-user"; const char kUmaUserSwitch[] = "uma-user";
......
...@@ -61,6 +61,9 @@ extern const char kExtendedSafeBrowsingEnabledSwitch[]; ...@@ -61,6 +61,9 @@ extern const char kExtendedSafeBrowsingEnabledSwitch[];
// Specifies the suffix to the registry path where metrics data will be saved. // Specifies the suffix to the registry path where metrics data will be saved.
extern const char kRegistrySuffixSwitch[]; extern const char kRegistrySuffixSwitch[];
// Indicates that resetting shortcuts is enabled.
extern const char kResetShortcutsSwitch[];
// Identifier used to group all reports generated during the same run of the // Identifier used to group all reports generated during the same run of the
// software reporter (which may include multiple invocations of the reporter // software reporter (which may include multiple invocations of the reporter
/// binary, each generating a report). An ASCII, base-64 encoded random string. /// binary, each generating a report). An ASCII, base-64 encoded random string.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment