Commit d08cd3b8 authored by Anthony Vallee-Dubois's avatar Anthony Vallee-Dubois Committed by Commit Bot

Alter backoff behavior in India trigger experiment

This CL changes the backoff behavior from "backoff after N consecutive
declines/ignores" to "backoff after N declines/ignores unless accepted
once"

Bug: 840367
Change-Id: I18d3d1ac10da566d55950a62f705dc1da3efa587
Reviewed-on: https://chromium-review.googlesource.com/1208711Reviewed-by: default avatarMichael Martis <martis@chromium.org>
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589161}
parent d1fd2bc1
......@@ -491,6 +491,13 @@ TEST_F(TranslateManagerTest,
EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName),
ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 2),
Bucket(INITIATION_STATUS_SHOW_ICON, 2)));
// Initiating Translation again should still show the UI because accepting
// once prevents backoff from occurring moving forward.
translate_manager_->InitiateTranslation("en");
EXPECT_THAT(histogram_tester.GetAllSamples(kInitiationStatusName),
ElementsAre(Bucket(INITIATION_STATUS_SHOW_INFOBAR, 3),
Bucket(INITIATION_STATUS_SHOW_ICON, 3)));
}
TEST_F(TranslateManagerTest, ShouldHonorExperimentRankerEnforcement_Enforce) {
......
......@@ -839,13 +839,14 @@ int TranslatePrefs::GetForceTriggerOnEnglishPagesCount() const {
void TranslatePrefs::ReportForceTriggerOnEnglishPages() {
int current_count = GetForceTriggerOnEnglishPagesCount();
if (current_count != -1)
prefs_->SetInteger(kForceTriggerTranslateCount, current_count + 1);
}
void TranslatePrefs::ReportAcceptedAfterForceTriggerOnEnglishPages() {
int current_count = GetForceTriggerOnEnglishPagesCount();
if (current_count > 0)
prefs_->SetInteger(kForceTriggerTranslateCount, current_count - 1);
if (current_count != -1)
prefs_->SetInteger(kForceTriggerTranslateCount, -1);
}
// static
......
......@@ -307,9 +307,10 @@ class TranslatePrefs {
// kOverrideTranslateTriggerInIndia experiment made translate trigger on an
// English page when it otherwise wouldn't have.
void ReportForceTriggerOnEnglishPages();
// Decrements the pref that represents how often the
// Sets to -1 the pref that represents how often the
// kOverrideTranslateTriggerInIndia experiment made translate trigger on an
// English page when it otherwise wouldn't have.
// English page when it otherwise wouldn't have. This is a special value that
// signals that the backoff should not happen for that user.
void ReportAcceptedAfterForceTriggerOnEnglishPages();
// Migrate the sites blacklist from a list to a dictionary that maps sites
......
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