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/chrome_browser_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "apps/field_trial_names.h" | 9 #include "apps/field_trial_names.h" |
10 #include "apps/pref_names.h" | 10 #include "apps/pref_names.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 trial->Disable(); | 196 trial->Disable(); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 // Sets up the experiment. The actual cache backend choice is made in the net/ | 200 // Sets up the experiment. The actual cache backend choice is made in the net/ |
201 // internals by looking at the experiment state. | 201 // internals by looking at the experiment state. |
202 void ChromeBrowserFieldTrials::SetUpSimpleCacheFieldTrial() { | 202 void ChromeBrowserFieldTrials::SetUpSimpleCacheFieldTrial() { |
203 if (parsed_command_line_.HasSwitch(switches::kUseSimpleCacheBackend)) { | 203 if (parsed_command_line_.HasSwitch(switches::kUseSimpleCacheBackend)) { |
204 const std::string opt_value = parsed_command_line_.GetSwitchValueASCII( | 204 const std::string opt_value = parsed_command_line_.GetSwitchValueASCII( |
205 switches::kUseSimpleCacheBackend); | 205 switches::kUseSimpleCacheBackend); |
206 if (LowerCaseEqualsASCII(opt_value, "off")) { | |
207 // This is the default. | |
208 return; | |
209 } | |
210 const base::FieldTrial::Probability kDivisor = 100; | 206 const base::FieldTrial::Probability kDivisor = 100; |
211 scoped_refptr<base::FieldTrial> trial( | 207 scoped_refptr<base::FieldTrial> trial( |
212 base::FieldTrialList::FactoryGetFieldTrial("SimpleCacheTrial", kDivisor, | 208 base::FieldTrialList::FactoryGetFieldTrial("SimpleCacheTrial", kDivisor, |
213 "No", 2013, 12, 31, NULL)); | 209 "ExperimentNo", 2013, 12, 31, |
| 210 NULL)); |
214 trial->UseOneTimeRandomization(); | 211 trial->UseOneTimeRandomization(); |
| 212 if (LowerCaseEqualsASCII(opt_value, "off")) { |
| 213 trial->AppendGroup("ExplicitNo", kDivisor); |
| 214 return; |
| 215 } |
215 if (LowerCaseEqualsASCII(opt_value, "on")) { | 216 if (LowerCaseEqualsASCII(opt_value, "on")) { |
216 trial->AppendGroup("Yes", 100); | 217 trial->AppendGroup("ExplicitYes", kDivisor); |
217 return; | 218 return; |
218 } | 219 } |
219 #if defined(OS_ANDROID) | 220 #if defined(OS_ANDROID) |
220 if (LowerCaseEqualsASCII(opt_value, "experiment")) { | 221 if (LowerCaseEqualsASCII(opt_value, "experiment")) { |
221 // TODO(pasko): Make this the default on Android when the simple cache | 222 // TODO(pasko): Make this the default on Android when the simple cache |
222 // adds a few more necessary features. Also adjust the probability. | 223 // adds a few more necessary features. Also adjust the probability. |
223 const base::FieldTrial::Probability kSimpleCacheProbability = 1; | 224 const base::FieldTrial::Probability kSimpleCacheProbability = 1; |
224 trial->AppendGroup("Yes", kSimpleCacheProbability); | 225 trial->AppendGroup("ExperimentYes", kSimpleCacheProbability); |
225 trial->AppendGroup("Control", kSimpleCacheProbability); | 226 trial->AppendGroup("ExperimentControl", kSimpleCacheProbability); |
226 trial->group(); | 227 trial->group(); |
227 } | 228 } |
228 #endif | 229 #endif |
229 } | 230 } |
230 } | 231 } |
231 | 232 |
232 void ChromeBrowserFieldTrials::SetUpCacheSensitivityAnalysisFieldTrial() { | 233 void ChromeBrowserFieldTrials::SetUpCacheSensitivityAnalysisFieldTrial() { |
233 const base::FieldTrial::Probability kDivisor = 100; | 234 const base::FieldTrial::Probability kDivisor = 100; |
234 | 235 |
235 base::FieldTrial::Probability sensitivity_analysis_probability = 0; | 236 base::FieldTrial::Probability sensitivity_analysis_probability = 0; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Call |FindValue()| on the trials below, which may come from the server, to | 291 // Call |FindValue()| on the trials below, which may come from the server, to |
291 // ensure they get marked as "used" for the purposes of data reporting. | 292 // ensure they get marked as "used" for the purposes of data reporting. |
292 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); | 293 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); |
293 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); | 294 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); |
294 base::FieldTrialList::FindValue("InstantDummy"); | 295 base::FieldTrialList::FindValue("InstantDummy"); |
295 base::FieldTrialList::FindValue("InstantChannel"); | 296 base::FieldTrialList::FindValue("InstantChannel"); |
296 base::FieldTrialList::FindValue("Test0PercentDefault"); | 297 base::FieldTrialList::FindValue("Test0PercentDefault"); |
297 // Activate the autocomplete dynamic field trials. | 298 // Activate the autocomplete dynamic field trials. |
298 OmniboxFieldTrial::ActivateDynamicTrials(); | 299 OmniboxFieldTrial::ActivateDynamicTrials(); |
299 } | 300 } |
OLD | NEW |