diff options
author | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 07:08:07 +0000 |
---|---|---|
committer | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 07:08:07 +0000 |
commit | 2d4729587b4377874e12be4c578333f02f0cba4b (patch) | |
tree | 457c4cb66b23eb7b7ff2eef50decd77b479d3b62 /content | |
parent | c263bc8d3aae4595f1351a70c80142438e017e26 (diff) | |
download | chromium_src-2d4729587b4377874e12be4c578333f02f0cba4b.zip chromium_src-2d4729587b4377874e12be4c578333f02f0cba4b.tar.gz chromium_src-2d4729587b4377874e12be4c578333f02f0cba4b.tar.bz2 |
Field Trials choices can now be forced from a command line argument, and yet still behave as if a coin was tossed, except the coin is tricked :-).
To do this, we needed to change the usage from a regular constructor (which is not private) to a static CreateInstance method (which is why there is a bunch of TBR'd owners, those changes were trivial to existing users of FieldTrials).
OWNERs of trivially changed files:
TBR=sky,jamesr,cpu,joi,
BUG=119726
TEST=base_unittests.exe --gtest_filter=FieldTrialTest.*
You can also find an active field trial name and force it to a given group by passing the following command line argument "--force-fieldtest=<trial_name>/<default_group_name>/<group_name>/"
Review URL: http://codereview.chromium.org/9705074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_process_host_impl.cc | 2 | ||||
-rw-r--r-- | content/public/common/content_switches.cc | 16 | ||||
-rw-r--r-- | content/public/common/content_switches.h | 2 | ||||
-rw-r--r-- | content/renderer/renderer_main.cc | 6 |
4 files changed, 12 insertions, 14 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index d62cada..e38a37f 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -632,7 +632,7 @@ void RenderProcessHostImpl::AppendRendererCommandLine( std::string field_trial_states; base::FieldTrialList::StatesToString(&field_trial_states); if (!field_trial_states.empty()) { - command_line->AppendSwitchASCII(switches::kForceFieldTestNameAndValue, + command_line->AppendSwitchASCII(switches::kForceFieldTrials, field_trial_states); } diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 2819e1d..c660c57 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -366,17 +366,15 @@ const char kExtraPluginDir[] = "extra-plugin-dir"; // the base layer even when compositing is not strictly required. const char kForceCompositingMode[] = "force-compositing-mode"; -// Some field tests may rendomized in the browser, and the randomly selected -// outcome needs to be propagated to the renderer. For instance, this is used +// Some field trials may be randomized in the browser, and the randomly selected +// outcome needs to be propagated to the renderer. For instance, this is used // to modify histograms recorded in the renderer, or to get the renderer to // also set of its state (initialize, or not initialize components) to match the -// experiment(s). -// The argument is a string-ized list of experiment names, and the associated -// value that was randomly selected. In the recent implementetaion, the -// persistent representation generated by field_trial.cc and later decoded, is a -// list of name and value pairs, separated by slashes. See field trial.cc for -// current details. -const char kForceFieldTestNameAndValue[] = "force-fieldtest"; +// experiment(s). The option is also useful for forcing field trials when +// testing changes locally. The argument is a list of name and value pairs, +// separated by slashes. See FieldTrialList::CreateTrialsFromString() in +// field_trial.h for details. +const char kForceFieldTrials[] = "force-fieldtrials"; // Force renderer accessibility to be on instead of enabling it on demand when // a screen reader is detected. The disable-renderer-accessibility switch diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index d63df83..fb1bff4 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -117,7 +117,7 @@ CONTENT_EXPORT extern const char kDisableWebIntents[]; CONTENT_EXPORT extern const char kExperimentalLocationFeatures[]; extern const char kExtraPluginDir[]; CONTENT_EXPORT extern const char kForceCompositingMode[]; -extern const char kForceFieldTestNameAndValue[]; +extern const char kForceFieldTrials[]; CONTENT_EXPORT extern const char kForceRendererAccessibility[]; extern const char kGpuLauncher[]; CONTENT_EXPORT extern const char kGpuProcess[]; diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index becc623..24354fe 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -236,10 +236,10 @@ int RendererMain(const content::MainFunctionParams& parameters) { // one-time randomized trials; they should be created in the browser process. base::FieldTrialList field_trial(EmptyString()); // Ensure any field trials in browser are reflected into renderer. - if (parsed_command_line.HasSwitch(switches::kForceFieldTestNameAndValue)) { + if (parsed_command_line.HasSwitch(switches::kForceFieldTrials)) { std::string persistent = parsed_command_line.GetSwitchValueASCII( - switches::kForceFieldTestNameAndValue); - bool ret = field_trial.CreateTrialsInChildProcess(persistent); + switches::kForceFieldTrials); + bool ret = base::FieldTrialList::CreateTrialsFromString(persistent); DCHECK(ret); } |