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/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // get ingrained, users tend to learn that a particular suggestion is | 57 // get ingrained, users tend to learn that a particular suggestion is |
58 // at a particular spot in the drop-down--we're going to make these | 58 // at a particular spot in the drop-down--we're going to make these |
59 // field trials sticky. We want users to stay in them once assigned | 59 // field trials sticky. We want users to stay in them once assigned |
60 // so they have a better experience and also so we don't get weird | 60 // so they have a better experience and also so we don't get weird |
61 // effects as omnibox ranking keeps changing and users learn they can't | 61 // effects as omnibox ranking keeps changing and users learn they can't |
62 // trust the omnibox. Hence, to create the field trials we require | 62 // trust the omnibox. Hence, to create the field trials we require |
63 // that field trials can be made sticky. | 63 // that field trials can be made sticky. |
64 if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) { // sticky trials | 64 if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) { // sticky trials |
65 // Create aggressive History URL Provider field trial. | 65 // Create aggressive History URL Provider field trial. |
66 // Make it expire on August 1, 2012. | 66 // Make it expire on August 1, 2012. |
67 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( | 67 scoped_refptr<base::FieldTrial> trial( |
68 kAggressiveHUPFieldTrialName, kAggressiveHUPFieldTrialDivisor, | 68 base::FieldTrialList::FactoryGetFieldTrial( |
69 "Standard", 2012, 8, 1)); | 69 kAggressiveHUPFieldTrialName, kAggressiveHUPFieldTrialDivisor, |
| 70 "Standard", 2012, 8, 1, NULL)); |
70 trial->UseOneTimeRandomization(); | 71 trial->UseOneTimeRandomization(); |
71 aggressive_hup_experiment_group = trial->AppendGroup("Aggressive", | 72 aggressive_hup_experiment_group = trial->AppendGroup("Aggressive", |
72 kAggressiveHUPFieldTrialExperimentFraction); | 73 kAggressiveHUPFieldTrialExperimentFraction); |
73 | 74 |
74 // Create inline History Quick Provider field trial. | 75 // Create inline History Quick Provider field trial. |
75 // Make it expire on November 8, 2012. | 76 // Make it expire on November 8, 2012. |
76 trial = new base::FieldTrial( | 77 trial = base::FieldTrialList::FactoryGetFieldTrial( |
77 kDisallowInlineHQPFieldTrialName, kDisallowInlineHQPFieldTrialDivisor, | 78 kDisallowInlineHQPFieldTrialName, kDisallowInlineHQPFieldTrialDivisor, |
78 "Standard", 2012, 11, 8); | 79 "Standard", 2012, 11, 8, NULL); |
79 trial->UseOneTimeRandomization(); | 80 trial->UseOneTimeRandomization(); |
80 disallow_inline_hqp_experiment_group = trial->AppendGroup("DisallowInline", | 81 disallow_inline_hqp_experiment_group = trial->AppendGroup("DisallowInline", |
81 kDisallowInlineHQPFieldTrialExperimentFraction); | 82 kDisallowInlineHQPFieldTrialExperimentFraction); |
82 } | 83 } |
83 | 84 |
84 // Create the suggest field trial (regardless of sticky-ness status, but | 85 // Create the suggest field trial (regardless of sticky-ness status, but |
85 // make it sticky if possible). | 86 // make it sticky if possible). |
86 // Make it expire on October 1, 2012. | 87 // Make it expire on October 1, 2012. |
87 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( | 88 scoped_refptr<base::FieldTrial> trial( |
88 kSuggestFieldTrialName, kSuggestFieldTrialNumberOfGroups, | 89 base::FieldTrialList::FactoryGetFieldTrial( |
89 "0", 2012, 10, 1)); | 90 kSuggestFieldTrialName, kSuggestFieldTrialNumberOfGroups, |
| 91 "0", 2012, 10, 1, NULL)); |
90 if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) | 92 if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) |
91 trial->UseOneTimeRandomization(); | 93 trial->UseOneTimeRandomization(); |
92 // We've already created one group; now just need to create | 94 // We've already created one group; now just need to create |
93 // kSuggestFieldTrialNumGroups - 1 more. | 95 // kSuggestFieldTrialNumGroups - 1 more. |
94 for (int i = 1; i < kSuggestFieldTrialNumberOfGroups; i++) | 96 for (int i = 1; i < kSuggestFieldTrialNumberOfGroups; i++) |
95 trial->AppendGroup(base::StringPrintf("%d", i), 1); | 97 trial->AppendGroup(base::StringPrintf("%d", i), 1); |
96 } | 98 } |
97 | 99 |
98 bool AutocompleteFieldTrial::InAggressiveHUPFieldTrial() { | 100 bool AutocompleteFieldTrial::InAggressiveHUPFieldTrial() { |
99 return base::FieldTrialList::TrialExists(kAggressiveHUPFieldTrialName); | 101 return base::FieldTrialList::TrialExists(kAggressiveHUPFieldTrialName); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // get numbers that we know are 0, 1, 2, ... | 142 // get numbers that we know are 0, 1, 2, ... |
141 int AutocompleteFieldTrial::GetSuggestGroupNameAsNumber() { | 143 int AutocompleteFieldTrial::GetSuggestGroupNameAsNumber() { |
142 int group_num; | 144 int group_num; |
143 base::StringToInt(GetSuggestGroupName(), &group_num); | 145 base::StringToInt(GetSuggestGroupName(), &group_num); |
144 return group_num; | 146 return group_num; |
145 } | 147 } |
146 | 148 |
147 int AutocompleteFieldTrial::GetSuggestNumberOfGroups() { | 149 int AutocompleteFieldTrial::GetSuggestNumberOfGroups() { |
148 return kSuggestFieldTrialNumberOfGroups; | 150 return kSuggestFieldTrialNumberOfGroups; |
149 } | 151 } |
OLD | NEW |