This source file includes following definitions.
- DataCompressionProxyBaseFieldTrial
- DataCompressionProxyFieldTrials
- SetupMobileFieldTrials
#include "chrome/browser/chrome_browser_field_trials_mobile.h"
#include <string>
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#if defined(OS_ANDROID)
#include "chrome/browser/prerender/prerender_field_trial.h"
#endif
namespace chrome {
namespace {
void DataCompressionProxyBaseFieldTrial(
const char* trial_name,
const base::FieldTrial::Probability enabled_group_probability,
const base::FieldTrial::Probability total_probability) {
const char kEnabled[] = "Enabled";
const char kDisabled[] = "Disabled";
const bool kIsStableChannel =
chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
scoped_refptr<base::FieldTrial> trial(
base::FieldTrialList::FactoryGetFieldTrial(
trial_name,
total_probability,
kDisabled, 2015, 1, 1, base::FieldTrial::ONE_TIME_RANDOMIZED, NULL));
const int kEnabledGroup = trial->AppendGroup(
kEnabled,
kIsStableChannel ? enabled_group_probability : total_probability);
const int v = trial->group();
VLOG(1) << trial_name << " enabled group id: " << kEnabledGroup
<< ". Selected group id: " << v;
}
void DataCompressionProxyFieldTrials() {
DataCompressionProxyBaseFieldTrial(
"DataCompressionProxyRollout", 1000, 1000);
DataCompressionProxyBaseFieldTrial(
"DataCompressionProxyPromoVisibility", 100, 1000);
}
}
void SetupMobileFieldTrials(const CommandLine& parsed_command_line,
const base::Time& install_time,
PrefService* local_state) {
DataCompressionProxyFieldTrials();
#if defined(OS_ANDROID)
prerender::ConfigurePrerender(parsed_command_line);
#endif
}
}