OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/trials/throttling_trial.h" | |
6 | |
7 #include "base/metrics/field_trial.h" | |
8 #include "chrome/browser/prefs/pref_service.h" | |
9 #include "chrome/common/pref_names.h" | |
10 | |
11 namespace throttling_trial { | |
12 | |
13 void CreateTrial(PrefService* prefs) { | |
14 DCHECK(prefs); | |
15 | |
16 // We only use one-time randomization, meaning each client will be put | |
17 // in the same group on every startup, so that users do not have a situation | |
18 // where they are intermittently in the experiment group, and have problems | |
19 // because of throttling, then turn off their browser to fix the problem, | |
20 // come back, and cannot figure out why they had problems (because throttling | |
21 // will most likely by then be turned off). A lesser concern is that if | |
22 // we didn't use one-time randomization, users might notice the preference | |
23 // in about:net-internals toggling from one state to the other. | |
24 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled()) | |
25 return; | |
26 | |
27 // Probability for each trial group (the experiment and the control) is 5%. | |
28 const base::FieldTrial::Probability kEachGroupProbability = 5; | |
29 const base::FieldTrial::Probability kTotalProbability = 100; | |
30 // After June 30, 2011 builds, the trial will always be in default group. | |
31 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( | |
32 "ThrottlingEnabled", kTotalProbability, "Default", 2011, 6, 30)); | |
yzshen1
2011/06/08 00:56:51
[out of curiosity]
June 30, 2011 means this will o
Jói
2011/06/08 16:44:47
Correct, this is just 5% of the dev channel for no
| |
33 trial->UseOneTimeRandomization(); | |
34 | |
35 // If the user has touched the control for whether throttling is enabled | |
36 // or not, we only allow the Default group for the trial, and we do not | |
37 // modify the value of prefs::kHttpThrottlingEnabled. | |
38 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { | |
39 int experiment_group = | |
40 trial->AppendGroup("Experiment", kEachGroupProbability); | |
41 | |
42 // The behavior for the control group is the same as for the default group. | |
43 // The point of having the control group is that it's the same size as | |
44 // the experiment group and selected the same way, so we get an | |
45 // apples-to-apples comparison of histograms. | |
46 trial->AppendGroup("Control", kEachGroupProbability); | |
47 | |
48 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, | |
49 trial->group() == experiment_group); | |
50 } | |
51 } | |
52 | |
53 } // namespace throttling_trial | |
OLD | NEW |