Chromium Code Reviews| Index: chrome/browser/autocomplete/autocomplete_field_trial.cc |
| diff --git a/chrome/browser/autocomplete/autocomplete_field_trial.cc b/chrome/browser/autocomplete/autocomplete_field_trial.cc |
| index edde0cf4036ba54dee21e2d0e9336da9e804bb1f..705e7977c4d423c8389397f9924db32a2f3ac978 100644 |
| --- a/chrome/browser/autocomplete/autocomplete_field_trial.cc |
| +++ b/chrome/browser/autocomplete/autocomplete_field_trial.cc |
| @@ -27,6 +27,8 @@ static const char kHUPCreateShorterMatchFieldTrialName[] = |
| "OmniboxHUPCreateShorterMatch"; |
| static const char kHQPReplaceHUPScoringFieldTrialName[] = |
| "OmniboxHQPReplaceHUPNumComponentsFix"; |
| +static const char kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName[] = |
| + "OmniboxHQPOnlyCountMatchesAtWordBoundaries"; |
| // Field trial experiment probabilities. |
| @@ -74,6 +76,13 @@ const base::FieldTrial::Probability |
| const base::FieldTrial::Probability |
| kHQPReplaceHUPScoringFieldTrialExperimentFraction = 25; |
| +// For the field trial that ignores all mid-term matches in HistoryQuick |
| +// provider, put 25% ( = 25/100 ) of the users in the experiment group. |
| +const base::FieldTrial::Probability |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialDivisor = 100; |
| +const base::FieldTrial::Probability |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentFraction = 25; |
| + |
| // Field trial IDs. |
| // Though they are not literally "const", they are set only once, in |
| @@ -97,6 +106,10 @@ int hup_dont_create_shorter_match_experiment_group = 0; |
| // experiment group. |
| int hqp_replace_hup_scoring_experiment_group = 0; |
| +// Field trial ID for the HistoryQuick provider only count matches at |
| +// word boundaries experiment group. |
| +int hqp_only_count_matches_at_word_boundaries_experiment_group = 0; |
| + |
| } |
| @@ -191,6 +204,18 @@ void AutocompleteFieldTrial::Activate() { |
| trial->UseOneTimeRandomization(); |
| hqp_replace_hup_scoring_experiment_group = trial->AppendGroup("HQPReplaceHUP", |
| kHQPReplaceHUPScoringFieldTrialExperimentFraction); |
| + |
| + // Create the field trial that makes HistoryQuick provider score |
| + // ignore all matches that happen in the middle of a word. Make it |
| + // expire on June 23, 2013. |
| + trial = base::FieldTrialList::FactoryGetFieldTrial( |
|
Bart N.
2012/11/29 17:32:26
Out of curiosity, why isn't important to make sure
Mark P
2012/11/29 19:36:48
The new scoring field trial is currently disabled.
|
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName, |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialDivisor, |
| + "Standard", 2013, 6, 23, NULL); |
| + trial->UseOneTimeRandomization(); |
| + hqp_only_count_matches_at_word_boundaries_experiment_group = |
| + trial->AppendGroup("HQPOnlyCountMatchesAtWordBoundaries", |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentFraction); |
| } |
| bool AutocompleteFieldTrial::InDisallowInlineHQPFieldTrial() { |
| @@ -264,3 +289,19 @@ bool AutocompleteFieldTrial::InHQPReplaceHUPScoringFieldTrialExperimentGroup() { |
| kHQPReplaceHUPScoringFieldTrialName); |
| return group == hqp_replace_hup_scoring_experiment_group; |
| } |
| + |
| +bool AutocompleteFieldTrial::InHQPOnlyCountMatchesAtWordBoundariesFieldTrial() { |
| + return base::FieldTrialList::TrialExists( |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName); |
| +} |
| + |
| +bool AutocompleteFieldTrial:: |
| + InHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentGroup() { |
| + if (!InHQPOnlyCountMatchesAtWordBoundariesFieldTrial()) |
| + return false; |
| + |
| + // Return true if we're in the experiment group. |
| + const int group = base::FieldTrialList::FindValue( |
| + kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName); |
| + return group == hqp_only_count_matches_at_word_boundaries_experiment_group; |
| +} |