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 | 31 |
31 // Field trial experiment probabilities. | 32 // Field trial experiment probabilities. |
32 | 33 |
33 // For inline History Quick Provider field trial, put 0% ( = 0/100 ) | 34 // For inline History Quick Provider field trial, put 0% ( = 0/100 ) |
34 // of the users in the disallow-inline experiment group. | 35 // of the users in the disallow-inline experiment group. |
35 const base::FieldTrial::Probability kDisallowInlineHQPFieldTrialDivisor = 100; | 36 const base::FieldTrial::Probability kDisallowInlineHQPFieldTrialDivisor = 100; |
36 const base::FieldTrial::Probability | 37 const base::FieldTrial::Probability |
37 kDisallowInlineHQPFieldTrialExperimentFraction = 0; | 38 kDisallowInlineHQPFieldTrialExperimentFraction = 0; |
38 | 39 |
39 // For the search suggestion field trial, divide the people in the | 40 // For the search suggestion field trial, divide the people in the |
40 // trial into 20 equally-sized buckets. The suggest provider backend | 41 // trial into 20 equally-sized buckets. The suggest provider backend |
41 // will decide what behavior (if any) to change based on the group. | 42 // will decide what behavior (if any) to change based on the group. |
42 const int kSuggestFieldTrialNumberOfGroups = 20; | 43 const int kSuggestFieldTrialNumberOfGroups = 20; |
43 | 44 |
44 // For History Quick Provider new scoring field trial, put 0% ( = 0/100 ) | 45 // For History Quick Provider new scoring field trial, put 25% ( = 25/100 ) |
45 // of the users in the new scoring experiment group. | 46 // of the users in the new scoring experiment group. |
46 const base::FieldTrial::Probability kHQPNewScoringFieldTrialDivisor = 100; | 47 const base::FieldTrial::Probability kHQPNewScoringFieldTrialDivisor = 100; |
47 const base::FieldTrial::Probability | 48 const base::FieldTrial::Probability |
48 kHQPNewScoringFieldTrialExperimentFraction = 0; | 49 kHQPNewScoringFieldTrialExperimentFraction = 25; |
49 | 50 |
50 // For HistoryURL provider cull redirects field trial, put 0% ( = 0/100 ) | 51 // For HistoryURL provider cull redirects field trial, put 0% ( = 0/100 ) |
51 // of the users in the don't-cull-redirects experiment group. | 52 // of the users in the don't-cull-redirects experiment group. |
52 // TODO(mpearson): Remove this field trial and the code it uses once I'm | 53 // TODO(mpearson): Remove this field trial and the code it uses once I'm |
53 // sure it's no longer needed. | 54 // sure it's no longer needed. |
54 const base::FieldTrial::Probability kHUPCullRedirectsFieldTrialDivisor = 100; | 55 const base::FieldTrial::Probability kHUPCullRedirectsFieldTrialDivisor = 100; |
55 const base::FieldTrial::Probability | 56 const base::FieldTrial::Probability |
56 kHUPCullRedirectsFieldTrialExperimentFraction = 0; | 57 kHUPCullRedirectsFieldTrialExperimentFraction = 0; |
57 | 58 |
58 // For HistoryURL provider create shorter match field trial, put 0% | 59 // For HistoryURL provider create shorter match field trial, put 0% |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 static_cast<chrome_variations::VariationID>( | 147 static_cast<chrome_variations::VariationID>( |
147 chrome_variations::kSuggestTrialStarted2012Q4IDMin + i)); | 148 chrome_variations::kSuggestTrialStarted2012Q4IDMin + i)); |
148 } | 149 } |
149 | 150 |
150 // Make sure that we participate in the suggest experiment by calling group() | 151 // Make sure that we participate in the suggest experiment by calling group() |
151 // on the newly created field trial. This is necessary to activate the field | 152 // on the newly created field trial. This is necessary to activate the field |
152 // trial group as there are no more references to it within the Chrome code. | 153 // trial group as there are no more references to it within the Chrome code. |
153 trial->group(); | 154 trial->group(); |
154 | 155 |
155 // Create inline History Quick Provider new scoring field trial. | 156 // Create inline History Quick Provider new scoring field trial. |
156 // Make it expire on January 14, 2013. | 157 // Make it expire on April 14, 2013. |
157 trial = base::FieldTrialList::FactoryGetFieldTrial( | 158 trial = base::FieldTrialList::FactoryGetFieldTrial( |
158 kHQPNewScoringFieldTrialName, kHQPNewScoringFieldTrialDivisor, | 159 kHQPNewScoringFieldTrialName, kHQPNewScoringFieldTrialDivisor, |
159 "Standard", 2013, 1, 14, NULL); | 160 "Standard", 2013, 4, 14, NULL); |
160 trial->UseOneTimeRandomization(); | 161 trial->UseOneTimeRandomization(); |
161 hqp_new_scoring_experiment_group = trial->AppendGroup("NewScoring", | 162 hqp_new_scoring_experiment_group = trial->AppendGroup("NewScoring", |
162 kHQPNewScoringFieldTrialExperimentFraction); | 163 kHQPNewScoringFieldTrialExperimentFraction); |
163 | 164 |
164 // Create the HistoryURL provider cull redirects field trial. | 165 // Create the HistoryURL provider cull redirects field trial. |
165 // Make it expire on March 1, 2013. | 166 // Make it expire on March 1, 2013. |
166 trial = base::FieldTrialList::FactoryGetFieldTrial( | 167 trial = base::FieldTrialList::FactoryGetFieldTrial( |
167 kHUPCullRedirectsFieldTrialName, kHUPCullRedirectsFieldTrialDivisor, | 168 kHUPCullRedirectsFieldTrialName, kHUPCullRedirectsFieldTrialDivisor, |
168 "Standard", 2013, 3, 1, NULL); | 169 "Standard", 2013, 3, 1, NULL); |
169 trial->UseOneTimeRandomization(); | 170 trial->UseOneTimeRandomization(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 258 |
258 bool AutocompleteFieldTrial::InHQPReplaceHUPScoringFieldTrialExperimentGroup() { | 259 bool AutocompleteFieldTrial::InHQPReplaceHUPScoringFieldTrialExperimentGroup() { |
259 if (!InHQPReplaceHUPScoringFieldTrial()) | 260 if (!InHQPReplaceHUPScoringFieldTrial()) |
260 return false; | 261 return false; |
261 | 262 |
262 // Return true if we're in the experiment group. | 263 // Return true if we're in the experiment group. |
263 const int group = base::FieldTrialList::FindValue( | 264 const int group = base::FieldTrialList::FindValue( |
264 kHQPReplaceHUPScoringFieldTrialName); | 265 kHQPReplaceHUPScoringFieldTrialName); |
265 return group == hqp_replace_hup_scoring_experiment_group; | 266 return group == hqp_replace_hup_scoring_experiment_group; |
266 } | 267 } |
OLD | NEW |