This document describes how to add your new feature behind a flag.
This step would be different between where you want to use the flag. For example, if you want to use the flag in src/content, you should add a base::Feature to the following files:
If you want to use the flag in blink, you should also read Runtime Enable Features.
You can refer to this CL to see
Also, this patch added a virtual test for running web tests with the flag. When you add a flag, you can consider to use that.
You have to modify these four files in total.
At first you need to add an entry to about_flags.cc, flag_descriptions.cc and flag_descriptions.h. After that, try running the following test.
# Build unit_tests autoninja -C out/Default unit_tests # Run AboutFlagsHistogramTest.CheckHistograms ./out/Default/unit_tests --gtest_filter=AboutFlagsHistogramTest.CheckHistograms # Run AboutFlagsHistogramTest.CheckHistograms on Android ./out/Default/bin/run_unit_tests --gtest_filter=AboutFlagsHistogramTest.CheckHistograms
That test will ask you to add several entries to enums.xml. You can refer to this CL as an example.