blob: 4ea5f94c3a913af68f94226cbef88ee019ce119b [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
Andrew Williams07af7f62024-07-16 23:05:568perf bots and various tests in the waterfall (browser tests, including those in
9browser_tests, components_browsertests, content_browsertests,
10extensions_browsertests, interactive_ui_tests, and sync_integration_tests, and
11[web platform tests](/docs/testing/web_platform_tests.md)). It is not used by
12unit test targets.
robliao2ff53322016-09-23 19:28:2413
Alex Rudenkocbe846e72024-11-29 09:01:0014> Note: This configuration applies specifically to Chromium developer and
15> [Chrome for Testing branded](https://goo.gle/chrome-for-testing) builds.
16> Chrome branded builds do not use these definitions by default. They can, however,
17> be enabled with the `--enable-field-trial-config` switch.
Luc Nguyen0e516644a2022-02-18 15:32:2418> For Chrome branded Android builds, due to binary size constraints, the
19> configuration cannot be applied by this switch.
robliao2ff53322016-09-23 19:28:2420
Alexei Svitkine3126867622020-12-02 23:03:0221> Note: Non-developer builds of Chromium (for example, non-Chrome browsers,
22> or Chromium builds provided by Linux distros) should disable the testing
Luc Nguyen1180c662022-02-08 20:38:5923> config by either (1) specifying the GN flag `disable_fieldtrial_testing_config=true`,
Alexei Svitkinef89da71f2023-10-20 21:39:3724> (2) specifying the `--disable-field-trial-config` switch or (3) specifying a
25> custom variations server URL using the `--variations-server-url` switch.
Luc Nguyen1180c662022-02-08 20:38:5926
27> Note: An experiment in the testing configuration file that enables/disables a
28> feature that is explicitly overridden (e.g. using the `--enable-features` or
29> `--disable-features` switches) will be skipped.
Alexei Svitkine3126867622020-12-02 23:03:0230
robliao2ff53322016-09-23 19:28:2431## Config File Format
32
33```json
34{
35 "StudyName": [
36 {
37 "platforms": [Array of Strings of Valid Platforms for These Experiments],
38 "experiments": [
39 {
40 "//0": "Comment Line 0. Lines 0-9 are supported.",
41 "name": "ExperimentName",
42 "params": {Dictionary of Params},
43 "enable_features": [Array of Strings of Features],
44 "disable_features": [Array of Strings of Features]
45 },
46 ...
47 ]
48 },
49 ...
50 ],
51 ...
52}
53```
54
55The config file is a dictionary at the top level mapping a study name to an
Carlos Knippschilde12741b2019-12-12 01:26:2356array of *study configurations*. The study name in the configuration file
57**must** match the FieldTrial name used in the Chromium client code.
ishermana509c1852017-03-23 21:11:3558
59> Note: Many newer studies do not use study names in the client code at all, and
60> rely on the [Feature List API][FeatureListAPI] instead. Nonetheless, if a
Carlos Knippschilde12741b2019-12-12 01:26:2361> study has a server-side configuration, the study `name` specified here
62> must still match the name specified in the server-side configuration; this is
Joe Mason8c711c202021-07-14 20:04:1463> used to implement consistency checks on the server.
robliao2ff53322016-09-23 19:28:2464
65### Study Configurations
66
ishermana509c1852017-03-23 21:11:3567Each *study configuration* is a dictionary containing `platforms` and
robliao2ff53322016-09-23 19:28:2468`experiments`.
69
ishermana509c1852017-03-23 21:11:3570`platforms` is an array of strings, indicating the targetted platforms. The
thefrog95a334fc2022-06-28 16:00:2871strings may be `android`, `android_weblayer`, `android_webview`, `chromeos`,
72`chromeos_lacros`, `ios`, `linux`, `mac`, or `windows`.
robliao2ff53322016-09-23 19:28:2473
74`experiments` is an array containing the *experiments*.
75
ishermana509c1852017-03-23 21:11:3576The converter uses the `platforms` array to determine which experiment to use
77for the study. The first experiment matching the active platform will be used.
78
79> Note: While `experiments` is defined as an array, currently only the first
80> entry is used*\**. We would love to be able to test all possible study
81> configurations, but don't currently have the buildbot resources to do so.
82> Hence, the current best-practice is to identify which experiment group is the
83> most likely candidate for ultimate launch, and to test that configuration. If
84> there is a server-side configuration for this study, it's typically
85> appropriate to copy/paste one of the experiment definitions into this file.
86>
87> *\**
88> <small>
89> Technically, there is one exception: If there's a forcing_flag group
90> specified in the config, that group will be used if there's a corresponding
91> forcing_flag specified on the command line. You, dear reader, should
92> probably not use this fancy mechanism unless you're <em>quite</em> sure you
93> know what you're doing =)
94> </small>
robliao2ff53322016-09-23 19:28:2495
96### Experiments (Groups)
97Each *experiment* is a dictionary that must contain the `name` key, identifying
Ilya Sherman84225992020-02-28 00:39:2198the experiment group name.
ishermana509c1852017-03-23 21:11:3599
Ilya Sherman84225992020-02-28 00:39:21100> Note: Studies should typically use the [Feature List API][FeatureListAPI]. For
101> such studies, the experiment `name` specified in the testing config is still
102> required (for legacy reasons), but it is ignored. However, the lists of
103> `enable_features`, `disable_features`, and `params` **must** match the server
104> config. This is enforced via server-side Tricorder checks.
105>
106> For old-school studies that do check the actual experiment group name in the
107> client code, the `name` **must** exactly match the client code and the server
108> config.
robliao2ff53322016-09-23 19:28:24109
Jonathan Backer60ac0ec2020-06-17 15:40:53110The remaining keys -- `enable_features`, `disable_features`, `min_os_version`,
Stephen Nusko57c6a9862025-04-25 04:22:39111`disable_benchmarking`, and `params` -- are optional.
robliao2ff53322016-09-23 19:28:24112
robliao2ff53322016-09-23 19:28:24113`enable_features` and `disable_features` indicate which features should be
ishermana509c1852017-03-23 21:11:35114enabled and disabled, respectively, through the
115[Feature List API][FeatureListAPI].
116
Jonathan Backer60ac0ec2020-06-17 15:40:53117`min_os_version` indicates a minimum OS version level (e.g. "10.0.0") to apply
118the experiment. This string is decoded as a `base::Version`. The same version is
119applied to all platforms. If you need different versions for different
120platforms, you will need to use different studies.
121
Stephen Nusko57c6a9862025-04-25 04:22:39122`disable_benchmarking` indicates that when the flag
123`--enable-benchmarking` is passed at start up this experiment should not be
124enabled. This should be used extremely sparingly.
125
Stephen Nuskoff12758762025-05-23 03:01:41126> Warning: `disable_benchmarking` works as described above on most platforms
127> however when using the
128> [fieldtrial_util.py](https://source.chromium.org/chromium/chromium/src/+/main:tools/variations/fieldtrial_util.py)
129> script we will always exclude `disable_benchmarking` experiments. This is
130> due to this script being primarily used for benchmarking, and because it
131> generates command lines flags to set state we don't know if
132> `--enable-benchmarking` will be passed or not.
133
Ilya Sherman84225992020-02-28 00:39:21134`params` is a dictionary mapping parameter name to parameter value.
135
ishermana509c1852017-03-23 21:11:35136> Reminder: The variations framework does not actually fetch any field trial
137> definitions from the server for Chromium builds, so any feature enabling or
138> disabling must be configured here.
139
140[FeatureListAPI]: https://cs.chromium.org/chromium/src/base/feature_list.h
robliao2ff53322016-09-23 19:28:24141
142#### Comments
143
144Each experiment may have up to 10 lines of comments. The comment key must be of
145the form `//N` where `N` is between 0 and 9.
146
147```json
148{
149 "AStudyWithExperimentComment": [
150 {
Paul Millerad77b7892018-07-11 20:07:43151 "platforms": ["chromeos", "linux", "mac", "windows"],
robliao2ff53322016-09-23 19:28:24152 "experiments": [
153 {
154 "//0": "This is the first comment line.",
155 "//1": "This is the second comment line.",
156 "name": "DesktopExperiment"
157 }
158 ]
159 }
160 ]
161}
162```
163
164### Specifying Different Experiments for Different Platforms
165Simply specify two different study configurations in the study:
166
167```json
168{
169 "DifferentExperimentsPerPlatform": [
170 {
Paul Millerad77b7892018-07-11 20:07:43171 "platforms": ["chromeos", "linux", "mac", "windows"],
robliao2ff53322016-09-23 19:28:24172 "experiments": [{ "name": "DesktopExperiment" }]
173 },
174 {
175 "platforms": ["android", "ios"],
176 "experiments": [{ "name": "MobileExperiment" }]
177 }
178 ]
179}
180```
181
Dominic Battref431ec72022-06-29 07:54:20182## Formatting
183
184Run the following command to auto-format the `fieldtrial_testing_config.json`
185configuration file:
186
187```shell
188python3 testing/variations/PRESUBMIT.py testing/variations/fieldtrial_testing_config.json
189```
190
191The presubmit tool will also ensure that your changes follow the correct
192ordering and format.