OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" | 5 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "chrome/common/metrics/variations/variation_ids.h" | 11 #include "chrome/common/metrics/variations/variation_ids.h" |
12 #include "chrome/common/metrics/variations/variations_util.h" | 12 #include "chrome/common/metrics/variations/variations_util.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Field trial names. | 16 // Field trial names. |
17 static const char kDisallowInlineHQPFieldTrialName[] = | 17 static const char kDisallowInlineHQPFieldTrialName[] = |
18 "OmniboxDisallowInlineHQP"; | 18 "OmniboxDisallowInlineHQP"; |
19 // Because we regularly change the name of the suggest field trial in | 19 // Because we regularly change the name of the suggest field trial in |
20 // order to shuffle users among groups, we use the date the current trial | 20 // order to shuffle users among groups, we use the date the current trial |
21 // was created as part of the name. | 21 // was created as part of the name. |
22 static const char kSuggestFieldTrialStarted2012Q4Name[] = | 22 static const char kSuggestFieldTrialStarted2012Q4Name[] = |
23 "OmniboxSearchSuggestTrialStarted2012Q4"; | 23 "OmniboxSearchSuggestTrialStarted2012Q4"; |
24 static const char kHQPNewScoringFieldTrialName[] = "OmniboxHQPNewScoring"; | 24 static const char kHQPNewScoringFieldTrialName[] = |
| 25 "OmniboxHQPNewScoringMax1400"; |
25 static const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; | 26 static const char kHUPCullRedirectsFieldTrialName[] = "OmniboxHUPCullRedirects"; |
26 static const char kHUPCreateShorterMatchFieldTrialName[] = | 27 static const char kHUPCreateShorterMatchFieldTrialName[] = |
27 "OmniboxHUPCreateShorterMatch"; | 28 "OmniboxHUPCreateShorterMatch"; |
28 static const char kHQPReplaceHUPScoringFieldTrialName[] = | 29 static const char kHQPReplaceHUPScoringFieldTrialName[] = |
29 "OmniboxHQPReplaceHUPNumComponentsFix"; | 30 "OmniboxHQPReplaceHUPNumComponentsFix"; |
30 static const char kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName[] = | 31 static const char kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName[] = |
31 "OmniboxHQPOnlyCountMatchesAtWordBoundaries"; | 32 "OmniboxHQPOnlyCountMatchesAtWordBoundaries"; |
32 | 33 |
33 // Field trial experiment probabilities. | 34 // Field trial experiment probabilities. |
34 | 35 |
35 // For inline History Quick Provider field trial, put 0% ( = 0/100 ) | 36 // For inline History Quick Provider field trial, put 0% ( = 0/100 ) |
36 // of the users in the disallow-inline experiment group. | 37 // of the users in the disallow-inline experiment group. |
37 const base::FieldTrial::Probability kDisallowInlineHQPFieldTrialDivisor = 100; | 38 const base::FieldTrial::Probability kDisallowInlineHQPFieldTrialDivisor = 100; |
38 const base::FieldTrial::Probability | 39 const base::FieldTrial::Probability |
39 kDisallowInlineHQPFieldTrialExperimentFraction = 0; | 40 kDisallowInlineHQPFieldTrialExperimentFraction = 0; |
40 | 41 |
41 // For the search suggestion field trial, divide the people in the | 42 // For the search suggestion field trial, divide the people in the |
42 // trial into 20 equally-sized buckets. The suggest provider backend | 43 // trial into 20 equally-sized buckets. The suggest provider backend |
43 // will decide what behavior (if any) to change based on the group. | 44 // will decide what behavior (if any) to change based on the group. |
44 const int kSuggestFieldTrialNumberOfGroups = 20; | 45 const int kSuggestFieldTrialNumberOfGroups = 20; |
45 | 46 |
46 // For History Quick Provider new scoring field trial, put 0% ( = 0/100 ) | 47 // For History Quick Provider new scoring field trial, put 25% ( = 25/100 ) |
47 // of the users in the new scoring experiment group. | 48 // of the users in the new scoring experiment group. |
48 const base::FieldTrial::Probability kHQPNewScoringFieldTrialDivisor = 100; | 49 const base::FieldTrial::Probability kHQPNewScoringFieldTrialDivisor = 100; |
49 const base::FieldTrial::Probability | 50 const base::FieldTrial::Probability |
50 kHQPNewScoringFieldTrialExperimentFraction = 0; | 51 kHQPNewScoringFieldTrialExperimentFraction = 25; |
51 | 52 |
52 // For HistoryURL provider cull redirects field trial, put 0% ( = 0/100 ) | 53 // For HistoryURL provider cull redirects field trial, put 0% ( = 0/100 ) |
53 // of the users in the don't-cull-redirects experiment group. | 54 // of the users in the don't-cull-redirects experiment group. |
54 // TODO(mpearson): Remove this field trial and the code it uses once I'm | 55 // TODO(mpearson): Remove this field trial and the code it uses once I'm |
55 // sure it's no longer needed. | 56 // sure it's no longer needed. |
56 const base::FieldTrial::Probability kHUPCullRedirectsFieldTrialDivisor = 100; | 57 const base::FieldTrial::Probability kHUPCullRedirectsFieldTrialDivisor = 100; |
57 const base::FieldTrial::Probability | 58 const base::FieldTrial::Probability |
58 kHUPCullRedirectsFieldTrialExperimentFraction = 0; | 59 kHUPCullRedirectsFieldTrialExperimentFraction = 0; |
59 | 60 |
60 // For HistoryURL provider create shorter match field trial, put 0% | 61 // For HistoryURL provider create shorter match field trial, put 0% |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 static_cast<chrome_variations::VariationID>( | 160 static_cast<chrome_variations::VariationID>( |
160 chrome_variations::kSuggestTrialStarted2012Q4IDMin + i)); | 161 chrome_variations::kSuggestTrialStarted2012Q4IDMin + i)); |
161 } | 162 } |
162 | 163 |
163 // Make sure that we participate in the suggest experiment by calling group() | 164 // Make sure that we participate in the suggest experiment by calling group() |
164 // on the newly created field trial. This is necessary to activate the field | 165 // on the newly created field trial. This is necessary to activate the field |
165 // trial group as there are no more references to it within the Chrome code. | 166 // trial group as there are no more references to it within the Chrome code. |
166 trial->group(); | 167 trial->group(); |
167 | 168 |
168 // Create inline History Quick Provider new scoring field trial. | 169 // Create inline History Quick Provider new scoring field trial. |
169 // Make it expire on January 14, 2013. | 170 // Make it expire on April 14, 2013. |
170 trial = base::FieldTrialList::FactoryGetFieldTrial( | 171 trial = base::FieldTrialList::FactoryGetFieldTrial( |
171 kHQPNewScoringFieldTrialName, kHQPNewScoringFieldTrialDivisor, | 172 kHQPNewScoringFieldTrialName, kHQPNewScoringFieldTrialDivisor, |
172 "Standard", 2013, 1, 14, NULL); | 173 "Standard", 2013, 4, 14, NULL); |
173 trial->UseOneTimeRandomization(); | 174 trial->UseOneTimeRandomization(); |
174 hqp_new_scoring_experiment_group = trial->AppendGroup("NewScoring", | 175 hqp_new_scoring_experiment_group = trial->AppendGroup("NewScoring", |
175 kHQPNewScoringFieldTrialExperimentFraction); | 176 kHQPNewScoringFieldTrialExperimentFraction); |
176 | 177 |
177 // Create the HistoryURL provider cull redirects field trial. | 178 // Create the HistoryURL provider cull redirects field trial. |
178 // Make it expire on March 1, 2013. | 179 // Make it expire on March 1, 2013. |
179 trial = base::FieldTrialList::FactoryGetFieldTrial( | 180 trial = base::FieldTrialList::FactoryGetFieldTrial( |
180 kHUPCullRedirectsFieldTrialName, kHUPCullRedirectsFieldTrialDivisor, | 181 kHUPCullRedirectsFieldTrialName, kHUPCullRedirectsFieldTrialDivisor, |
181 "Standard", 2013, 3, 1, NULL); | 182 "Standard", 2013, 3, 1, NULL); |
182 trial->UseOneTimeRandomization(); | 183 trial->UseOneTimeRandomization(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 bool AutocompleteFieldTrial:: | 299 bool AutocompleteFieldTrial:: |
299 InHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentGroup() { | 300 InHQPOnlyCountMatchesAtWordBoundariesFieldTrialExperimentGroup() { |
300 if (!InHQPOnlyCountMatchesAtWordBoundariesFieldTrial()) | 301 if (!InHQPOnlyCountMatchesAtWordBoundariesFieldTrial()) |
301 return false; | 302 return false; |
302 | 303 |
303 // Return true if we're in the experiment group. | 304 // Return true if we're in the experiment group. |
304 const int group = base::FieldTrialList::FindValue( | 305 const int group = base::FieldTrialList::FindValue( |
305 kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName); | 306 kHQPOnlyCountMatchesAtWordBoundariesFieldTrialName); |
306 return group == hqp_only_count_matches_at_word_boundaries_experiment_group; | 307 return group == hqp_only_count_matches_at_word_boundaries_experiment_group; |
307 } | 308 } |
OLD | NEW |