diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 21:23:28 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-26 21:23:28 +0000 |
commit | a314ee5ab5322b95a861e38fdc377ec156b0add9 (patch) | |
tree | 2d0fa078b04673a594db1f08032ea60c7402c1ea /chrome/browser/about_flags.h | |
parent | daed5ecdf85e983a9ff2aa0d7db5c7fdd34b71ab (diff) | |
download | chromium_src-a314ee5ab5322b95a861e38fdc377ec156b0add9.zip chromium_src-a314ee5ab5322b95a861e38fdc377ec156b0add9.tar.gz chromium_src-a314ee5ab5322b95a861e38fdc377ec156b0add9.tar.bz2 |
Fixes bug in about:flags where we weren't pruning experiments that
are not enabled for the current platform but were at one point.
BUG=60206
TEST=none
Review URL: http://codereview.chromium.org/3989002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63952 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/about_flags.h')
-rw-r--r-- | chrome/browser/about_flags.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/browser/about_flags.h b/chrome/browser/about_flags.h index 81b0c2a..0fcb3b9 100644 --- a/chrome/browser/about_flags.h +++ b/chrome/browser/about_flags.h @@ -16,6 +16,35 @@ class PrefService; namespace about_flags { +// Enumeration of OSs. +// This is exposed only for testing. +enum { kOsMac = 1 << 0, kOsWin = 1 << 1, kOsLinux = 1 << 2 , kOsCrOS = 1 << 3 }; + +// Experiment is used internally by about_flags to describe an experiment (and +// for testing). +// This is exposed only for testing. +struct Experiment { + // The internal name of the experiment. This is never shown to the user. + // It _is_ however stored in the prefs file, so you shouldn't change the + // name of existing flags. + const char* internal_name; + + // String id of the message containing the experiment's name. + int visible_name_id; + + // String id of the message containing the experiment's description. + int visible_description_id; + + // The platforms the experiment is available on + // Needs to be more than a compile-time #ifdef because of profile sync. + unsigned supported_platforms; // bitmask + + // The commandline parameter that's added when this lab is active. This is + // different from |internal_name| so that the commandline flag can be + // renamed without breaking the prefs file. + const char* command_line; +}; + // Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the // commandline flags belonging to the active experiments to |command_line|. void ConvertFlagsToSwitches(PrefService* prefs, CommandLine* command_line); @@ -35,9 +64,18 @@ void SetExperimentEnabled( void RemoveFlagsSwitches( std::map<std::string, CommandLine::StringType>* switch_list); +// Returns the value for the current platform. This is one of the values defined +// by the OS enum above. +// This is exposed only for testing. +int GetCurrentPlatform(); + namespace testing { // Clears internal global state, for unit tests. void ClearState(); + +// Sets the list of experiments. Pass in NULL to use the default set. This does +// NOT take ownership of the supplied Experiments. +void SetExperiments(const Experiment* e, size_t count); } // namespace testing } // namespace about_flags |