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 #ifndef CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
6 #define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 | 13 |
14 // This class manages the Instant field trial. Each user is in exactly one of | 14 // This class manages the Instant field trial. Each user is in exactly one of |
15 // two field trial groups: Control or Experiment. | 15 // three field trial groups: Inactive, Control or Experiment. |
| 16 // - Inactive users are those who have played with the Instant option in the |
| 17 // Preferences page, or those for whom group policy provides an override, or |
| 18 // those with an incognito profile, etc. The field trial is inactive for such |
| 19 // users, so their Instant preference setting is respected. The field trial is |
| 20 // also initially inactive (until activated in BrowserMain), so testing is not |
| 21 // affected by the field trial. |
16 // - Control and Experiment are all the other users, i.e., those who have never | 22 // - Control and Experiment are all the other users, i.e., those who have never |
17 // touched the Preferences option. Some percentage of these users are chosen | 23 // touched the Preferences option. Some percentage of these users are chosen |
18 // into the Experiment group and get Instant enabled automatically. The rest | 24 // into the Experiment group and get Instant enabled automatically. The rest |
19 // fall into the Control group; for them, Instant remains disabled by default. | 25 // fall into the Control group; for them, Instant remains disabled by default. |
20 // - Control and Experiment are further split into two subgroups each, in order | 26 // - Control and Experiment are further split into two subgroups each, in order |
21 // to detect bias between them (when analyzing metrics). The subgroups are | 27 // to detect bias between them (when analyzing metrics). The subgroups are |
22 // treated identically for all other purposes. | 28 // treated identically for all other purposes. |
23 // | |
24 // There is a possibility that the field trial is not active. | |
25 // - Inactive users are those who have played with the Instant option in the | |
26 // Preferences page, or those for whom group policy provides an override, or | |
27 // those with an incognito profile, etc. The field trial is inactive for such | |
28 // users, so their Instant preference setting is respected. The field trial is | |
29 // initially inactive so testing is not affected by the field trial. | |
30 class InstantFieldTrial { | 29 class InstantFieldTrial { |
31 public: | 30 public: |
32 enum Group { | 31 enum Group { |
33 INACTIVE, | 32 INACTIVE, |
34 CONTROL1, | 33 CONTROL1, |
35 CONTROL2, | 34 CONTROL2, |
36 EXPERIMENT1, | 35 EXPERIMENT1, |
37 EXPERIMENT2, | 36 EXPERIMENT2, |
38 }; | 37 }; |
39 | 38 |
40 // Activate the field trial. Before this call, all calls to GetGroup will | 39 // Activate the field trial. Before this call, all calls to GetGroup will |
41 // return INACTIVE. | 40 // return INACTIVE. *** MUST NOT BE CALLED MORE THAN ONCE. *** |
42 static void Activate(); | 41 static void Activate(); |
43 | 42 |
44 // Return the field trial group this profile belongs to. | 43 // Return the field trial group this profile belongs to. |
45 static Group GetGroup(Profile* profile); | 44 static Group GetGroup(Profile* profile); |
46 | 45 |
47 // Check if the group is either of the two experiment subgroups. | 46 // Check if the group is either of the two experiment subgroups. |
48 static bool IsExperimentGroup(Profile* profile); | 47 static bool IsExperimentGroup(Profile* profile); |
49 | 48 |
50 // Returns a string describing the user's group. Can be added to histogram | 49 // Returns a string describing the user's group. Can be added to histogram |
51 // names, to split histograms by field trial groups. | 50 // names, to split histograms by field trial groups. |
52 static std::string GetGroupName(Profile* profile); | 51 static std::string GetGroupName(Profile* profile); |
53 | 52 |
54 private: | 53 private: |
55 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); | 54 DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); |
56 }; | 55 }; |
57 | 56 |
58 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ | 57 #endif // CHROME_BROWSER_INSTANT_INSTANT_FIELD_TRIAL_H_ |
OLD | NEW |