Extract ChromeBrowserFieldTrials out of ChromeBrowserMainParts.

BUG=none
TEST=compiles

Review URL: https://chromiumcodereview.appspot.com/10827080

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149216 0039d316-1c4b-4281-b951-d872f2087c98
parent 5fe3e1a2
......@@ -20,7 +20,6 @@
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/background/background_mode_manager.h"
#include "chrome/browser/browser_trial.h"
#include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_plugin_service_filter.h"
......
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/browser_trial.h"
// The following is a sample of the lines that should be listed here.
// // A test to determine the impact of kCase1 vs kCase2 pruning algorithms.
// const wchar_t* BrowserTrial::kPruningAlgorithmFieldTrial =
// L"pruning_algorithm";
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// BrowserTrial contains methods specific to field trials (using FieldTrial
// functionality) for browser tests.
#ifndef CHROME_BROWSER_BROWSER_TRIAL_H_
#define CHROME_BROWSER_BROWSER_TRIAL_H_
#include "base/basictypes.h"
// Currently we use this as a name space, to hold static shared constants which
// define current and past trials.
class BrowserTrial {
public:
// The following is a sample line for what should be listed in this file.
// static const wchar_t* kPruningAlgorithmFieldTrial;
private:
DISALLOW_COPY_AND_ASSIGN(BrowserTrial);
};
#endif // CHROME_BROWSER_BROWSER_TRIAL_H_
This diff is collapsed.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROME_BROWSER_FIELD_TRIALS_H_
#define CHROME_BROWSER_CHROME_BROWSER_FIELD_TRIALS_H_
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/gtest_prod_util.h"
class ChromeBrowserFieldTrials {
public:
explicit ChromeBrowserFieldTrials(const CommandLine& command_line);
~ChromeBrowserFieldTrials();
// Add an invocation of your field trial init function to this method.
void SetupFieldTrials(bool proxy_policy_is_set);
private:
FRIEND_TEST_ALL_PREFIXES(BrowserMainTest,
WarmConnectionFieldTrial_WarmestSocket);
FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Random);
FRIEND_TEST_ALL_PREFIXES(BrowserMainTest, WarmConnectionFieldTrial_Invalid);
// A/B test for the maximum number of persistent connections per host.
void ConnectionFieldTrial();
// A/B test for determining a value for unused socket timeout.
void SocketTimeoutFieldTrial();
// A/B test for the maximum number of connections per proxy server.
void ProxyConnectionsFieldTrial();
// A/B test for spdy when --use-spdy not set.
void SpdyFieldTrial();
// A/B test for warmest socket vs. most recently used socket.
void WarmConnectionFieldTrial();
// A/B test for automatically establishing a backup TCP connection when a
// specified timeout value is reached.
void ConnectBackupJobsFieldTrial();
// Field trial to see what disabling DNS pre-resolution does to
// latency of page loads.
void PredictorFieldTrial();
// Field trial to see what effect installing defaults in the NTP apps pane
// has on retention and general apps/webstore usage.
void DefaultAppsFieldTrial();
// A field trial to see what effects launching Chrome automatically on
// computer startup has on retention and usage of Chrome.
void AutoLaunchChromeFieldTrial();
// A collection of one-time-randomized and session-randomized field trials
// intended to test the uniformity and correctness of the field trial control,
// bucketing and reporting systems.
void SetupUniformityFieldTrials();
// Disables the new tab field trial if not running in desktop mode.
void DisableNewTabFieldTrialIfNecesssary();
// Field trial for testing TLS channel id.
void ChannelIDFieldTrial();
const CommandLine& parsed_command_line_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserFieldTrials);
};
#endif // CHROME_BROWSER_CHROME_BROWSER_FIELD_TRIALS_H_
This diff is collapsed.
......@@ -11,6 +11,7 @@
#include "base/memory/scoped_vector.h"
#include "base/metrics/field_trial.h"
#include "base/tracked_objects.h"
#include "chrome/browser/chrome_browser_field_trials.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/task_profiler/auto_tracking.h"
......@@ -97,49 +98,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
const PrefService* local_state() const { return local_state_; }
private:
// Methods for |EarlyInitialization()| ---------------------------------------
// A/B test for the maximum number of persistent connections per host.
void ConnectionFieldTrial();
// A/B test for determining a value for unused socket timeout.
void SocketTimeoutFieldTrial();
// A/B test for the maximum number of connections per proxy server.
void ProxyConnectionsFieldTrial();
// A/B test for spdy when --use-spdy not set.
void SpdyFieldTrial();
// A/B test for warmest socket vs. most recently used socket.
void WarmConnectionFieldTrial();
// A/B test for automatically establishing a backup TCP connection when a
// specified timeout value is reached.
void ConnectBackupJobsFieldTrial();
// Field trial to see what disabling DNS pre-resolution does to
// latency of page loads.
void PredictorFieldTrial();
// Field trial to see what effect installing defaults in the NTP apps pane
// has on retention and general apps/webstore usage.
void DefaultAppsFieldTrial();
// A field trial to see what effects launching Chrome automatically on
// computer startup has on retention and usage of Chrome.
void AutoLaunchChromeFieldTrial();
// A collection of one-time-randomized and session-randomized field trials
// intended to test the uniformity and correctness of the field trial control,
// bucketing and reporting systems.
void SetupUniformityFieldTrials();
// Disables the new tab field trial if not running in desktop mode.
void DisableNewTabFieldTrialIfNecesssary();
// Field trial for testing TLS channel id.
void ChannelIDFieldTrial();
// Methods for |SetupMetricsAndFieldTrials()| --------------------------------
......@@ -148,9 +106,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
// switches.
void SetupMetricsAndFieldTrials();
// Add an invocation of your field trial init function to this method.
void SetupFieldTrials(bool proxy_policy_is_set);
// Starts recording of metrics. This can only be called after we have a file
// thread.
void StartMetricsRecording();
......@@ -186,6 +141,8 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
// SetupMetricsAndFieldTrials is called.
scoped_ptr<base::FieldTrialList> field_trial_list_;
ChromeBrowserFieldTrials browser_field_trials_;
// Vector of additional ChromeBrowserMainExtraParts.
// Parts are deleted in the inverse order they are added.
std::vector<ChromeBrowserMainExtraParts*> chrome_extra_parts_;
......
......@@ -38,7 +38,7 @@ TEST_F(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket) {
ChromeBrowserMainParts* cbw = static_cast<ChromeBrowserMainParts*>(bw.get());
EXPECT_TRUE(cbw);
if (cbw) {
cbw->WarmConnectionFieldTrial();
cbw->browser_field_trials_.WarmConnectionFieldTrial();
EXPECT_EQ(0, net::GetSocketReusePolicy());
}
}
......@@ -53,7 +53,7 @@ TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Random) {
if (cbw) {
const int kNumRuns = 1000;
for (int i = 0; i < kNumRuns; i++) {
cbw->WarmConnectionFieldTrial();
cbw->browser_field_trials_.WarmConnectionFieldTrial();
int val = net::GetSocketReusePolicy();
EXPECT_LE(val, 2);
EXPECT_GE(val, 0);
......@@ -80,10 +80,10 @@ TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Invalid) {
EXPECT_TRUE(cbw);
if (cbw) {
#if defined(NDEBUG) && defined(DCHECK_ALWAYS_ON)
EXPECT_DEATH(cbw->WarmConnectionFieldTrial(),
EXPECT_DEATH(cbw->browser_field_trials_.WarmConnectionFieldTrial(),
"Not a valid socket reuse policy group");
#else
EXPECT_DEBUG_DEATH(cbw->WarmConnectionFieldTrial(),
EXPECT_DEBUG_DEATH(cbw->browser_field_trials_.WarmConnectionFieldTrial(),
"Not a valid socket reuse policy group");
#endif
}
......
......@@ -345,8 +345,6 @@
'browser/browser_process_impl.h',
'browser/browser_shutdown.cc',
'browser/browser_shutdown.h',
'browser/browser_trial.cc',
'browser/browser_trial.h',
'browser/browser_util_win.cc',
'browser/browser_util_win.h',
'browser/browsing_data/browsing_data_appcache_helper.cc',
......@@ -399,6 +397,8 @@
'browser/chrome_benchmarking_message_filter.h',
'browser/chrome_browser_application_mac.h',
'browser/chrome_browser_application_mac.mm',
'browser/chrome_browser_field_trials.cc',
'browser/chrome_browser_field_trials.h',
'browser/chrome_browser_main.cc',
'browser/chrome_browser_main.h',
'browser/chrome_browser_main_extra_parts.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment