blob: 3ef066a79248d9f80486fc6bfd2cb173d440b462 [file] [log] [blame] [view]
robliao2ff53322016-09-23 19:28:241# Field Trial Testing Configuration
2
ishermana509c1852017-03-23 21:11:353This directory contains the `fieldtrial_testing_config.json` configuration file,
4which is used to ensure test coverage of active field trials.
robliao2ff53322016-09-23 19:28:245
ishermana509c1852017-03-23 21:11:356For each study, the first available experiment after platform filtering is used
7as the default experiment for Chromium builds. This experiment is also used for
John Abd-El-Malek6cd762c2021-06-15 18:59:378perf bots and various browser tests in the waterfall (e.g. browser_tests,
9components_browsertests, content_browsertests, extensions_browsertests, interactive_ui_tests and
10sync_integration_tests). It is not used by unit test targets.
robliao2ff53322016-09-23 19:28:2411
ishermana509c1852017-03-23 21:11:3512> Note: This configuration applies specifically to Chromium developer builds.
Luc Nguyen1180c662022-02-08 20:38:5913> Chrome branded / official builds do not use these definitions by default.
14> They can, however, be enabled with the `--enable-field-trial-config` switch.
Luc Nguyen0e516644a2022-02-18 15:32:2415> For Chrome branded Android builds, due to binary size constraints, the
16> configuration cannot be applied by this switch.
robliao2ff53322016-09-23 19:28:2417
Alexei Svitkine3126867622020-12-02 23:03:0218> Note: Non-developer builds of Chromium (for example, non-Chrome browsers,
19> or Chromium builds provided by Linux distros) should disable the testing
Luc Nguyen1180c662022-02-08 20:38:5920> config by either (1) specifying the GN flag `disable_fieldtrial_testing_config=true`,
21> (2) specifying the `--disable-field-trial-config` switch, (3) specifying field
22> trials using the `--force-fieldtrials` switch, or (4) specifying a custom
23> variations server URL using the `--variations-server-url` switch. In order to
24> apply the testing configuration as well as specify additional field trials
25> (using `--force-fieldtrials`), the `--enable-field-trial-config` switch can be
26> used.
27
28> Note: An experiment in the testing configuration file that enables/disables a
29> feature that is explicitly overridden (e.g. using the `--enable-features` or
30> `--disable-features` switches) will be skipped.
Alexei Svitkine3126867622020-12-02 23:03:0231
robliao2ff53322016-09-23 19:28:2432## Config File Format
33
34```json
35{
36 "StudyName": [
37 {
38 "platforms": [Array of Strings of Valid Platforms for These Experiments],
39 "experiments": [
40 {
41 "//0": "Comment Line 0. Lines 0-9 are supported.",
42 "name": "ExperimentName",
43 "params": {Dictionary of Params},
44 "enable_features": [Array of Strings of Features],
45 "disable_features": [Array of Strings of Features]
46 },
47 ...
48 ]
49 },
50 ...
51 ],
52 ...
53}
54```
55
56The config file is a dictionary at the top level mapping a study name to an
Carlos Knippschilde12741b2019-12-12 01:26:2357array of *study configurations*. The study name in the configuration file
58**must** match the FieldTrial name used in the Chromium client code.
ishermana509c1852017-03-23 21:11:3559
60> Note: Many newer studies do not use study names in the client code at all, and
61> rely on the [Feature List API][FeatureListAPI] instead. Nonetheless, if a
Carlos Knippschilde12741b2019-12-12 01:26:2362> study has a server-side configuration, the study `name` specified here
63> must still match the name specified in the server-side configuration; this is
Joe Mason8c711c202021-07-14 20:04:1464> used to implement consistency checks on the server.
robliao2ff53322016-09-23 19:28:2465
66### Study Configurations
67
ishermana509c1852017-03-23 21:11:3568Each *study configuration* is a dictionary containing `platforms` and
robliao2ff53322016-09-23 19:28:2469`experiments`.
70
ishermana509c1852017-03-23 21:11:3571`platforms` is an array of strings, indicating the targetted platforms. The
thefrog95a334fc2022-06-28 16:00:2872strings may be `android`, `android_weblayer`, `android_webview`, `chromeos`,
73`chromeos_lacros`, `ios`, `linux`, `mac`, or `windows`.
robliao2ff53322016-09-23 19:28:2474
75`experiments` is an array containing the *experiments*.
76
ishermana509c1852017-03-23 21:11:3577The converter uses the `platforms` array to determine which experiment to use
78for the study. The first experiment matching the active platform will be used.
79
80> Note: While `experiments` is defined as an array, currently only the first
81> entry is used*\**. We would love to be able to test all possible study
82> configurations, but don't currently have the buildbot resources to do so.
83> Hence, the current best-practice is to identify which experiment group is the
84> most likely candidate for ultimate launch, and to test that configuration. If
85> there is a server-side configuration for this study, it's typically
86> appropriate to copy/paste one of the experiment definitions into this file.
87>
88> *\**
89> <small>
90> Technically, there is one exception: If there's a forcing_flag group
91> specified in the config, that group will be used if there's a corresponding
92> forcing_flag specified on the command line. You, dear reader, should
93> probably not use this fancy mechanism unless you're <em>quite</em> sure you
94> know what you're doing =)
95> </small>
robliao2ff53322016-09-23 19:28:2496
97### Experiments (Groups)
98Each *experiment* is a dictionary that must contain the `name` key, identifying
Ilya Sherman84225992020-02-28 00:39:2199the experiment group name.
ishermana509c1852017-03-23 21:11:35100
Ilya Sherman84225992020-02-28 00:39:21101> Note: Studies should typically use the [Feature List API][FeatureListAPI]. For
102> such studies, the experiment `name` specified in the testing config is still
103> required (for legacy reasons), but it is ignored. However, the lists of
104> `enable_features`, `disable_features`, and `params` **must** match the server
105> config. This is enforced via server-side Tricorder checks.
106>
107> For old-school studies that do check the actual experiment group name in the
108> client code, the `name` **must** exactly match the client code and the server
109> config.
robliao2ff53322016-09-23 19:28:24110
Jonathan Backer60ac0ec2020-06-17 15:40:53111The remaining keys -- `enable_features`, `disable_features`, `min_os_version`,
112and `params` -- are optional.
robliao2ff53322016-09-23 19:28:24113
robliao2ff53322016-09-23 19:28:24114`enable_features` and `disable_features` indicate which features should be
ishermana509c1852017-03-23 21:11:35115enabled and disabled, respectively, through the
116[Feature List API][FeatureListAPI].
117
Jonathan Backer60ac0ec2020-06-17 15:40:53118`min_os_version` indicates a minimum OS version level (e.g. "10.0.0") to apply
119the experiment. This string is decoded as a `base::Version`. The same version is
120applied to all platforms. If you need different versions for different
121platforms, you will need to use different studies.
122
Ilya Sherman84225992020-02-28 00:39:21123`params` is a dictionary mapping parameter name to parameter value.
124
ishermana509c1852017-03-23 21:11:35125> Reminder: The variations framework does not actually fetch any field trial
126> definitions from the server for Chromium builds, so any feature enabling or
127> disabling must be configured here.
128
129[FeatureListAPI]: https://cs.chromium.org/chromium/src/base/feature_list.h
robliao2ff53322016-09-23 19:28:24130
131#### Comments
132
133Each experiment may have up to 10 lines of comments. The comment key must be of
134the form `//N` where `N` is between 0 and 9.
135
136```json
137{
138 "AStudyWithExperimentComment": [
139 {
Paul Millerad77b7892018-07-11 20:07:43140 "platforms": ["chromeos", "linux", "mac", "windows"],
robliao2ff53322016-09-23 19:28:24141 "experiments": [
142 {
143 "//0": "This is the first comment line.",
144 "//1": "This is the second comment line.",
145 "name": "DesktopExperiment"
146 }
147 ]
148 }
149 ]
150}
151```
152
153### Specifying Different Experiments for Different Platforms
154Simply specify two different study configurations in the study:
155
156```json
157{
158 "DifferentExperimentsPerPlatform": [
159 {
Paul Millerad77b7892018-07-11 20:07:43160 "platforms": ["chromeos", "linux", "mac", "windows"],
robliao2ff53322016-09-23 19:28:24161 "experiments": [{ "name": "DesktopExperiment" }]
162 },
163 {
164 "platforms": ["android", "ios"],
165 "experiments": [{ "name": "MobileExperiment" }]
166 }
167 ]
168}
169```
170
171## Presubmit
172The presubmit tool will ensure that your changes follow the correct ordering and
173format.