OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/trials/http_throttling_trial.h" | 5 #include "chrome/browser/trials/http_throttling_trial.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 | 10 |
11 void CreateHttpThrottlingTrial(PrefService* prefs) { | 11 void CreateHttpThrottlingTrial(PrefService* prefs) { |
12 DCHECK(prefs); | 12 DCHECK(prefs); |
13 | 13 |
14 // We only use one-time randomization, meaning each client will be put | 14 // We only use one-time randomization, meaning each client will be put |
15 // in the same group on every startup, so that users do not have a situation | 15 // in the same group on every startup, so that users do not have a situation |
16 // where they are intermittently in the experiment group, and have problems | 16 // where they are intermittently in the experiment group, and have problems |
17 // because of throttling, then turn off their browser to fix the problem, | 17 // because of throttling, then turn off their browser to fix the problem, |
18 // come back, and cannot figure out why they had problems (because throttling | 18 // come back, and cannot figure out why they had problems (because throttling |
19 // will most likely by then be turned off). A lesser concern is that if | 19 // will most likely by then be turned off). A lesser concern is that if |
20 // we didn't use one-time randomization, users might notice the preference | 20 // we didn't use one-time randomization, users might notice the preference |
21 // in about:net-internals toggling from one state to the other. | 21 // in about:net-internals toggling from one state to the other. |
22 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled()) | 22 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled()) |
23 return; | 23 return; |
24 | 24 |
25 // Probability for each trial group (the experiment and the control) is 5%. | 25 // Probability for each trial group (the experiment and the control) is 25%. |
26 const base::FieldTrial::Probability kEachGroupProbability = 5; | 26 const base::FieldTrial::Probability kEachGroupProbability = 25; |
27 const base::FieldTrial::Probability kTotalProbability = 100; | 27 const base::FieldTrial::Probability kTotalProbability = 100; |
28 // Disable trial a couple of days before M14 branch point. | 28 // Disable trial a couple of days before M15 branch point. |
29 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( | 29 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( |
30 "HttpThrottlingEnabled", kTotalProbability, "Default", 2011, 7, 23)); | 30 "HttpThrottlingEnabled", kTotalProbability, "Default", 2011, 9, 20)); |
31 trial->UseOneTimeRandomization(); | 31 trial->UseOneTimeRandomization(); |
32 | 32 |
33 // If the user has touched the control for whether throttling is enabled | 33 // If the user has touched the control for whether throttling is enabled |
34 // or not, we only allow the Default group for the trial, and we do not | 34 // or not, we only allow the Default group for the trial, and we do not |
35 // modify the value of prefs::kHttpThrottlingEnabled. | 35 // modify the value of prefs::kHttpThrottlingEnabled. |
36 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { | 36 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) { |
37 int experiment_group = | 37 int experiment_group = |
38 trial->AppendGroup("Experiment", kEachGroupProbability); | 38 trial->AppendGroup("Experiment", kEachGroupProbability); |
39 | 39 |
40 // The behavior for the control group is the same as for the default group. | 40 // The behavior for the control group is mostly the same as for |
41 // The point of having the control group is that it's the same size as | 41 // the default group, with the difference that we are guaranteed |
42 // the experiment group and selected the same way, so we get an | 42 // that none of the users in the control group have manually |
| 43 // changed the setting (under chrome://net-internals/) for whether |
| 44 // throttling should be turned on or not. The other point of |
| 45 // having the control group is that it's the same size as the |
| 46 // experiment group and selected the same way, so we get an |
43 // apples-to-apples comparison of histograms. | 47 // apples-to-apples comparison of histograms. |
44 trial->AppendGroup("Control", kEachGroupProbability); | 48 trial->AppendGroup("Control", kEachGroupProbability); |
45 | 49 |
46 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, | 50 prefs->SetBoolean(prefs::kHttpThrottlingEnabled, |
47 trial->group() == experiment_group); | 51 trial->group() == experiment_group); |
48 } | 52 } |
49 } | 53 } |
OLD | NEW |